Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

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.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2016-10-22 00:39 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (291 votes). Check out past polls.