in reply to Re: how to assign output of Find() into a variable $
in thread how to assign output of Find() into a variable $

Why so complicated? (a sub in a sub)

use strict; use warnings; use File::Find; my @result; find (sub { m/\.pl$/ and push @result, $File::Find::name; }, "aaa");

Enjoy, Have FUN! H.Merijn

Replies are listed 'Best First'.
Re^3: how to assign output of Find() into a variable $
by GrandFather (Saint) on May 18, 2016 at 09:37 UTC

    Because I hate javaScript nested functions!

    Actually, for a trivial sub the inline sub is fine. For something that does a little more work the inline call to the callback sub allows parameters to be passed and much more maintainable code.

    Premature optimization is the root of all job security