in reply to Re^2: Recursive search
in thread Recursive search
my @plf_files = ('files.plf','orphans.plf');
You will notice that I don't use $DATA for filehandle name. This is because there is a reserved filehandle called DATA, so $DATA would be confusing. You will also notice that there is not a grep in sight. The capturing parentheses group is saved into $1.sub recursion { my $plf = shift; open my $fh, '<', $plf or die "could not open '$plf' $!"; foreach (my $line = <$fh>){ if($line =~ /(\w+\.plf)$/) { $match_plf_name = $1; next if $match_plf_name eq $plf; push @recursive_plfs ,$match_plf_name; recursion($match_plf_name); } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Recursive search
by perl_mystery (Beadle) on Dec 17, 2010 at 19:39 UTC | |
by roboticus (Chancellor) on Dec 17, 2010 at 20:39 UTC | |
by perl_mystery (Beadle) on Dec 17, 2010 at 20:46 UTC | |
by poj (Abbot) on Dec 17, 2010 at 21:04 UTC | |
by perl_mystery (Beadle) on Dec 17, 2010 at 21:59 UTC | |
|