Just add one thing, with use strict and warnings, Perl does give error: (I added my in front of $picture, so that the error at line 15 is isolated)
use strict;
use warnings;
my $match = '1995_Olga_goes_to_Egypt';
my @pictures = qw{1995/1995_Olga_first_time_in_Cyprus/06330004.JPG
1995/1995_Olga_goes_to_Egypt/QD0017004.JPG};
foreach my $picture (sort @pictures) {
print "Debug: $picture\n";
if ($picture =~ m/$match/)
{
print "Matched, $picture\n";
last;
}
}
print "Result: $picture\n";
This gives:
Global symbol "$picture" requires explicit package name at math1.pl li
+ne 15.
Execution of math1.pl aborted due to compilation errors.