Maybe try: open(MYFILE, $match) || die "Can't open file: $!"; my @filelist = <MYFILE>; close(MYFILE);
chomp @filelist; foreach (@filelist) { find \&wanted($_), "."; } sub wanted { my $File = shift; print "Match found at : $File::Find::name\n" if $File; } For the $b array just: while (defined($b=<MYFILE>)) { if ($b =~ /^Open Table/){ $c = index($b, "As"); $b = substr ($b,12, $c-14); print "$b\n"; push(@TheNewArray,$b); } Hope that helps.. Greg --- Ben Crane <[EMAIL PROTECTED]> wrote: > I create a dummy file with 4 filenames in it...I have > read these 4 names into @filelist...and when I pass > the array to &wanted, it only looks for the last > file..I KNOW this works with arrays, I've done it > before...why does it keep taking the last value > only??? > > #!usr/bin/perl -w > use File::Find; > > $match=<STDIN>; > chomp $match; > > open(MYFILE, $match) || die "Can't open file: $!"; > @filelist=<MYFILE>; > > %files = map {$_=>1} @filelist; > find \&wanted, "."; > > sub wanted() > { > print "Match found at : $File::Find::name\n" if > $files{$_}; > } > > in addition: how can I put each $b value into an > array...so far, there should be ove 30 "Open Table" > lines in my file...I want a array with all 30 so I can > search for the files. I've tried $filename[$count] > with an incrementing variable...but no joy... > > while (defined($b=<MYFILE>)) > { > if ($b =~ /^Open Table/){ > $c = index($b, "As"); > $b = substr ($b,12, $c-14); > print "$b\n"; > > } > > Does anyone know any good references, beside perl.com > and cpan.org, etc on the web...when I try to hunt info > down I just get sites that cover the basics and > nothing more...if anyone knows of a site that has > loads of eg's of source code and show > intermediate-level array functions, please can u let > me know... > > thanx > Ben > > __________________________________________________ > Do You Yahoo!? > Find the one for you at Yahoo! Personals > http://personals.yahoo.com > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > __________________________________________________ Do You Yahoo!? Find the one for you at Yahoo! Personals http://personals.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]