#!/usr/bin/perl -w use strict; use warnings; my (@recursive_plfs,plf_files) =(); @plf_files = {files.plf,orphans.plf,bases.plf}; @file = {//source/perl/scripts/modem/final/rel/sw/bases.plf#30,//source/perl/scripts/modem/final/rel/sw/files.plf#3}; foreach my $plf (@plf_files) { if (grep @file) { push @recursive_plfs=$plf; #the below loop needs to be repeated until no .plf's are found,how do I do this? { open my $match, '<',"$plf" or die "could not open '$plf' $!"; push @recursive_plfs = /\/(\w+\.plf)/ = grep (/\*\.plf$/,$match) #get only the plf name from the match } } }