Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Re: Require input reading files recursively in perl

by kcott (Bishop)
on Apr 17, 2013 at 13:19 UTC ( #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?

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (7)
As of 2020-11-30 13:09 GMT
Find Nodes?
    Voting Booth?

    No recent polls found