Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: get list of files matching part of file name

by Anonymous Monk
on Jul 11, 2012 at 16:15 UTC ( #981184=note: print w/ replies, xml ) Need Help??


in reply to get list of files matching part of file name

What a strange way to use glob(). You're better off with proper use of readdir():

# open current directory for reading opendir my $dh, '.' or die; # iterate through the entries while (my $dir = readdir($dh)) { # your code here } closedir $dh;

If you want to use glob() properly, you need to do glob("*/*sample*") to get every file in the current directory's immediate subdirectories with 'sample' in its name.

There seems to be at least one real bug in your code: You aren't in /home/test when you do the glob.


Comment on Re: get list of files matching part of file name
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (8)
As of 2014-12-19 23:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (94 votes), past polls