Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re^3: get list of files matching part of file name

by Athanasius (Chancellor)
on Jul 11, 2012 at 13:29 UTC ( #981116=note: print w/replies, xml ) Need Help??

in reply to Re^2: get list of files matching part of file name
in thread get list of files matching part of file name

A couple of points:

(1) In the foreach loop, $file contains a filename together with its path and extension. To extract just the name part, you need something like:

(my $basename = fileparse($file)) =~ s/ \. .* $ //x;

which uses the fileparse function from File::Basename to extract the filename, then removes the extension (if any).

(2) print Dumper(@matches); will print each match on a separate line. You would probably be better off with something like this:

printf "'%s' matches: %s\n", $basename, join(', ', @matches);


Athanasius <°(((><contra mundum

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://981116]
[atcroft]: Lady_Aleena: By the way, I did look up another module (Tk), to see how it referred to other modules, and it used the L<module_name> POD linking, whereas the one I ran into today had hard-coded l<text|url> links.
[atcroft]: Sorry... L>text|url< links.
[atcroft]: Grrr.... L<text|url> links. .oO(Come on, brain, fingers, get it right this time.)

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2017-05-27 05:12 GMT
Find Nodes?
    Voting Booth?