Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: read_dir issue

by fishmonger (Chaplain)
on Aug 24, 2013 at 20:39 UTC ( #1050828=note: print w/replies, xml ) Need Help??


in reply to read_dir issue

You could/should add the "prefix" option in the read_dir statement so that the path will be prepended to the filename.

@files = read_dir($ARGV[0], prefix => 1);

EDIT:
I'd probably reduce your code a little, like this:

my $path = $ARGV[0] || '.'; my @files = read_dir($path, prefix => 1); for my $file (@files) { say -f $file ? "$file is a file" : "$file is a dir"; }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1050828]
help
Chatterbox?
[Lady_Aleena]: choroba, the tables in that group of modules is from the World Builder's Guidebook, so I thought it best to add the name of the book to the name of the module.
[choroba]: oh, I see
[Lady_Aleena]: There is the RolePlaying:: WorldBuilding:: WorldBuildersGuide book suite and the RolePlaying:: WorldBuilding:: HighLevelCampaigns suite.

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (9)
As of 2017-05-24 22:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?