perl, using File::Find is it possible to modify datastructure outside of
that function?
I am trying to traverse file in each folder and get info from that file
and update it to array For ex.
use File::Find;
sub main
{
my @names = ();
my $dir = "mydir";
# will traverse directories and look for file 'list.txt'
### now, is it possible to update @names while traversing using find?
find(\&getNames(), $dir);
}
sub getNames
{
#I tried to take names as argument but it doesn't seem to work..
if (-f $_ && $_ eq 'list.txt')
{
#update names possible?
}
}
Is it possible to update data structure while traversing using File::Find?
And I am trying not to use global variable..
No comments:
Post a Comment