in reply to Re: Recursive search
in thread Recursive search
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;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Recursive search
by Corion (Patriarch) on Dec 17, 2010 at 09:30 UTC | |
|
Re^3: Recursive search
by cdarke (Prior) on Dec 17, 2010 at 10:36 UTC | |
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 | |
|