> -----Original Message-----
> From: Ben Crane [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, November 13, 2001 10:30 AM
> To: [EMAIL PROTECTED]
> Subject: Array problems!
>
>
> 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>;
You probably need to chomp() these lines:
chomp(@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";
>
> }
perldoc -f push
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]