[Israel.pm] glob function give wrong results

Rami Addady rami at active.co.il
Sat Mar 19 09:10:01 PST 2005


Hi,

I have some problem using glob function, maybe I'm missing some thing.
glob give wrong result when file name contain space. 

For example: 

I have 4 file:
>ls -1 work* 

w1 Open WebMail.url.abc 
w1-Open-WebMail.url.abc 
w1 Open WebMail.url.abc__18-22__19-03-2005 
w1-Open-WebMail.url.abc__18-22__19-03-2005 

When running this program:

>cat glob_problem.pl 

$fname = "w1-Open-WebMail.url.abc"; 
print "file name: $fname\n"; 
my @files = glob($fname."*__??-??-????"); 
print "After glob: @files \n"; 
$fname = "w1 Open WebMail.url.abc"; 
print "file name: $fname\n"; 
my @files = glob($fname."*__??-??-????"); 
print "After glob: @files \n"; 

>perl glob_problem.pl 

file name: w1-Open-WebMail.url.abc 
After glob: w1-Open-WebMail.url.abc__18-22__19-03-2005 
file name: w1 Open WebMail.url.abc 
After glob: w1 Open 


Any Idea?

Regards,
Rami Addady




More information about the Perl mailing list