Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Require input reading files recursively in perl

by kcott (Archbishop)
on Apr 17, 2013 at 13:19 UTC ( [id://1029145]=note: print w/replies, xml ) Need Help??


in reply to Require input reading files recursively in perl

G'day jesuashok,

How about you add these lines to your code and let Perl tell you what's wrong:

use strict; use warnings;

strict should tell you about $file in while( defined ($file = readdir SCR) ) which, I believe, is your immediate problem.

warnings may pick up something I haven't spotted.

Please endeavour to add these two lines to all your scripts.

-- Ken

Replies are listed 'Best First'.
Re^2: Require input reading files recursively in perl
by educated_foo (Vicar) on Apr 17, 2013 at 14:06 UTC
    This standard chunk of cargo-cult programming won't actually fix the OP's problem, since the global SCR directory handle will still get overwritten. A dose of "local" or "my" will fix it, and an explanation of what is happening would lead to the right solution.
    Just another Perler interested in Algol Programming.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (6)
As of 2024-03-19 08:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found