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.