develooper Front page | perl.perl5.porters | Postings from June 2004

Re: File::Find modified to pass arguments to the wanted function

Thread Previous | Thread Next
From:
Nick Ing-Simmons
Date:
June 1, 2004 07:52
Subject:
Re: File::Find modified to pass arguments to the wanted function
Message ID:
20040601145220.7519.2@llama.elixent.com
Roger Yager <roger.yager@eyestreet.com> writes:
>Dear Perl developers,
>
> 
>
>            Over the years I have found myself using the File::Find module
>quite extensively.  However, there has been several times where I wanted to
>pass arguments to the callback routine instead of using global variables. 

The usual way I do that is with a closure:

{
 my $arg1 = ...
 find(sub {   ... $arg1 },...); 
}



Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About