The primary problem would be that you're match seems a bit backwards. Try "if ($line =~ m/$file/)" which will cut through any extra formatting output by dir.
Jim wrote: > Hi Everyone, > > I am trying to match file & subdir names from a back tic generated list. > I never find anything and there are files in the directory with a correct > name. > but if i make up a list to use as filenames > it works as i expect ... any insight greatly appreciated > > thanks > Jim > > #!/usr/bin/perl > > use strict; > use warnings; > > my @files = qw (filename1 filename2 filename3 filename4); > #my @dir = qw (file filenaml filename filename2); > my @dir = `dir`; > > foreach my $file (@files) > { > foreach my $line (@dir) > { > if ($file =~ m/$line/) > { > print "\nfound one\n"; > } > print "file - $file "; > print "line - $line\n"; > } > } > > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/