Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Re^2: "Deep recursion" error

by poj (Vicar)
on Jun 28, 2013 at 19:07 UTC ( #1041320=note: print w/ replies, xml ) Need Help??

in reply to Re: "Deep recursion" error
in thread "Deep recursion" error

Yes, you are close ..

#!perl use strict; use Cwd; # pwd has line ending, use this my $dir = cwd(); # protect against endless loop just in case ! my $limit = 10_000; # call with parameter start($dir); sub start { my $dir = shift; # add / to descend foreach (<$dir/*>) { die "exceeded limit" if --$limit < 0; print " $_ is file\n" if (-f $_); if (-d $_) { print "$_ is a dir\n"; start($_) } } }

Comment on Re^2: "Deep recursion" error
Download Code
Replies are listed 'Best First'.
Re^3: "Deep recursion" error
by cspctec (Sexton) on Jun 28, 2013 at 19:35 UTC
    Thank you poj, that works perfectly.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (10)
As of 2015-12-01 18:59 GMT
Find Nodes?
    Voting Booth?

    My keyboard shows this many letters:

    Results (25 votes), past polls