in reply to Re^4: while following perl hack book
in thread while following perl hack book

  1. The hack author just omitted the parens. When find is predeclared (or imported in this case), these two lines are identical:
    find sub { ... }, $dir_name ; find( sub { ... }, $dir_name );
  2. I thought that as well, but when I tried to refactor to the more efficient form (passing all directories at once), I noticed that the code in the &wanted sub needs to know the "root" directory name: $file =~ s{^\Q$incl_dir/\E}{ };. Passing all the dirs at once removes the ability to see $incl_dir.

Replies are listed 'Best First'.
Re^6: while following perl hack book
by convenientstore (Pilgrim) on Feb 05, 2008 at 04:58 UTC
    thank you guys as always
    These closure, anonymous sub and callback are little bit over my head, so I must do more reading and coding on the subject
    I will comment more on this as I learn more