Thanks,that worked.My below regex is failing for "script_rev1.1.plf",is it because \w is alphanumberic and doesnt match a "."(dot),can u pls suggest how to change the regex to match this awell
2. After pushing the "$match_plf_name" to "@recursive_plfs,when I try to print it,I only see the first element pushed getting printed,why only one element is getting stored in the array?if($line =~ /\/$(\w+\.plf)/)
foreach my $plf (@plf_files) { #print $plf; if (grep (/\Q$plf\E/i,@file)) { push @recursive_plfs,$plf; recursion($plf); } } sub recursion { my $plf = shift; #print "\nPLF in recursion:$plf\n"; open my $fh, '<', $plf or die "could not open '$plf' $!"; while (my $line = <$fh>) { chomp $line; #print "\nLINE:$line"; if($line =~ /\/(\w+\.plf)/) { #print "LINE CONDITION:$line"; $match_plf_name = $1; print "MATCH PLF:$match_plf_name\n"; next if $match_plf_name eq $plf; next if ( not grep { /\Q$match_plf_name\E/i } @plf_fil +es); print "IN"; push @recursive_plfs,$match_plf_name; recursion($match_plf_name); } } } foreach my $matchplf (@recursive_plfs) { print $matchplf; }
In reply to Re^8: Recursive search
by perl_mystery
in thread Recursive search
by perl_mystery
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |