From: "Paul Kraus" <[EMAIL PROTECTED]>
> Any ideas why this fails. If I remove if /aged/ and just have the if
> /Reports ... then everything works ok.
>
> Code....
> #!/usr/bin/perl
> my @files;
> my %age;
> push (@files, glob "Aged*");
> push (@files, glob "Receipts*");
>
> foreach (@files){
> open FILE,"<$_";
> print "$_\n";
> while(<FILE>){
> if ($_=~/Aged/){
Most probably because it can't find the "Aged" on the current line.
Didn't you mean to test whether the FILENAME matches /Aged/?
If so you should probably do it OUTSIDE the while(FILE) loop.
And you should use
foreach my $file (@files)
It's not very good to use $_ in both nested loops.
Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]