why isn't my below code printing anything?It should search recursively in the .plf's and print them,not sure where is it going wrong?
#!/usr/bin/perl -w use strict; use warnings; my @recursive_plfs =(); my ($plf,$match_plf, $match_plf_name); my @plf_files = {"files.plf","orphans.plf"}; print @plf_files; my @file = "PLF=//source/perl/scripts/build/software/files.plf#30"; foreach my $plf (@plf_files) { print $plf; if (grep (/\Q$plf\E/i,@file)) { push @recursive_plfs,$plf; recrusion($plf); } } sub recursion { open my $DATA, '<',"$plf" or die "could not open '$plf' $!"; foreach (my $line = <$DATA>){ if(grep (/\.plf$/,$line)) { $match_plf = grep (/\.plf$/,$line); print $match_plf; $match_plf_name =~ /\/(\w+\.plf)/;#get only the plf name(files.plf) f +rom //source/perl/scripts/build/software/files.plf#30 push @recursive_plfs ,$match_plf_name; recursion($match_plf_name); } } } print @recursive_plfs;
In reply to Re^2: Recursive search
by perl_mystery
in thread Recursive search
by perl_mystery
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |