Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Subroutine processes only one file in the directory

by toolic (Bishop)
on May 25, 2017 at 19:31 UTC ( [id://1191241]=note: print w/replies, xml ) Need Help??


in reply to Subroutine processes only one file in the directory

I see one mistake. Change:
my $filename = @_;

to:

my $filename = $_[0];

Your code always assigns $filename=1, instead of the actual file name. Prove this to yourself by printing $filename inside your sub right after the assignment.

See also: Basic debugging checklist

Replies are listed 'Best First'.
Re^2: Subroutine processes only one file in the directory
by sridhar56 (Initiate) on May 26, 2017 at 01:29 UTC
    I did that and it works! And you are right, when I was printing $filename, it returned one! Unfortunately I had a file named 1 and I thought it was only taking the last file in the array! Thanks for the help! :)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2024-04-25 15:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found