in reply to (jeffa) Re: searching all directories with perl
in thread searching all directories with perl

Recursion is a fairly advanced computer science technique that involves having a subroutine call itself. It can get quite tricky.

Huh? Fairly advanced? That's one of the first things you hear about in CS, I think. While I totally agree with the advice to use File::Find, I don't see a reason for advocacy against recursion in general. It can be a very elegant solution to solve problems in a simple and understandable way.

Of course recursion, if used wrongly, can lead to endless loops etc. But that's not an argument against using it. It's an argument in favour of learning to use recursion the right way.

  • Comment on Re: (jeffa) Re: searching all directories with perl

Replies are listed 'Best First'.
(jeffa) 3Re: searching all directories with perl
by jeffa (Bishop) on May 05, 2003 at 13:53 UTC
    Sorry, didn't mean to sound like i was arguing against recursion. Quite the contrary, recursion rules. I simply was pointing out that recursion is not easy, especially when first introduced to it. Remember, telling someone to use File::Find or File::Find::Rule is telling them to use recursion. ;)

    jeffa

    L-LL-L--L-LL-L--L-LL-L--
    -R--R-RR-R--R-RR-R--R-RR
    B--B--B--B--B--B--B--B--
    H---H---H---H---H---H---
    (the triplet paradiddle with high-hat)
    
      It's more like telling them "you need recursion, but it's hard to get right, so use this module which does the dirty work for you".

      Makeshifts last the longest.