Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^2: Glob strange bahavor

by ikegami (Patriarch)
on Aug 21, 2006 at 14:52 UTC ( [id://568560]=note: print w/replies, xml ) Need Help??


in reply to Re: Glob strange bahavor
in thread Glob strange behavior

He's checking if a file exists, so a simpler fix would be to use the command designed to check just that: -e (or -f).
#!/usr/bin/perl use strict; use warnings; my $path='C:/dataset/'; my @sign_arr=('A1', 'A2', 'A3','A4', 'A5', 'A6', 'A7', 'A8', 'A9'); foreach (@sign_arr) { my $filename = "$path*$_*.pkl"; if (-e $filename) {print "$filename $_\n"} else {print "not found $_\n";} }

Update: Ack, nevermind, I didn't notice his use of *. First post of the morning, sorry.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://568560]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (3)
As of 2024-04-26 00:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found