tamaguchi has asked for the wisdom of the Perl Monks concerning the following question:

In my folder C:/dataset/
I have the following files:

20051026ng3_Well A1_21593.pkl
20051026ng3_Well A2_21593.pkl
20051026ng3_Well A3_21593.pkl
20051026ng3_Well A4_21593.pkl
20051026ng3_Well A5_21593.pkl
20051026ng3_Well A6_21593.pkl
20051026ng3_Well A7_21593.pkl
20051026ng3_Well A8_21593.pkl
20051026ng3_Well A9_21593.pkl
To search for filenames containing alphanumeric signatures like A1, A2 etc. I have written the following:
#!/usr/bin/perl -w use strict; my $path='C:/dataset/'; my @sign_arr=('A1', 'A2', 'A3','A4', 'A5', 'A6', 'A7', 'A8', 'A9'); foreach (@sign_arr) { if(defined (my $filename=(glob("$path*$_*.pkl")))) {print "$filename $_\n"} else {print "not found $_\n";} }
The ouput I get is following:

C:/dataset/20051026ng3_Well A1_21593.pkl A1

Not found A2

C:/dataset/20051026ng3_Well A3_21593.pkl A3

Not found A4

C:/dataset/20051026ng3_Well A5_21593.pkl A5

Not found A6

C:/dataset/20051026ng3_Well A7_21593.pkl A7

Not found A8

C:/dataset/20051026ng3_Well A9_21593.pkl A9

I wonder how this small code could generate this results why are not all filenames containing the signatures A1, A2 etc. found? Thank you for your help.

2006-08-21 Retitled by holli, as per Monastery guidelines
Original title: 'Glob strange bahavor'