Skip to main content






I was using my $tmp = glob("file20240101.*") to find the full filename regardless of the extension(I knew there was only one of each file), when I found glob was alternating between working and failing

Rendering it as my ($tmp) = glob("file20240101.*") fixed the problem, but I'm wondering why, If it was going to go wrong I'd have thought treating glob's list in a scalar context would return the number of elements in the list

#!/usr/bin/perl
use warnings;
use strict;

for (1..4) {
my $tmp = glob($0);
print "$_ $tmp\n";
}
print "###\n";
for (1..4) {
my ($tmp) = glob($0);
print "$_ $tmp\n";
}

Output:
1 glob.pl
Use of uninitialized value $tmp in concatenation (.) or string at glob.pl line 7.
2
3 glob.pl
Use of uninitialized value $tmp in concatenation (.) or string at glob.pl line 7.
4
###
1 glob.pl
2 glob.pl
3 glob.pl
4 glob.pl

submitted by /u/octobod
[link] [comments]








The Perl Data Language (PDL) has its own Advent Calendar apart from the Perl Advent Calendar.

PDL Advent site (calendar view)

RSS feed

submitted by /u/briandfoy
[link] [comments]



Mo utilities for email.

Changes for 0.02 - 2024-04-26T23:02:53+02:00

  • Add tests for error parameters.
  • Rewrite the tests so that the functional tests are first and then the errors.