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)
- December 1 - What is Perl Data Language?
- December 2 - Maps with Perl Data Language
- December 3 - Perl Data Language on the Mac
- December 4 - (thread) Interpolation with Perl Data Language
- December 5
- December 6
- December 7
- December 8
- December 9
- December 10
- December 11
- December 12
- December 13
- December 14
- December 15
- December 16
- December 17
- December 18
- December 19
- December 20
- December 21
- December 22
- December 23
- December 24
- December 25
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.