I am not quite sure what you want to do here, but here is what i see:

the scalar your assining to the fh is being overwritten at each iteration
$tmp = <LOGFILE>; 
all  you need to do is open each file, and operate on the $_ var, you don't
need to assign the FH to a variable (unless you want to slurp it into an
array)


> -----Original Message-----
> From: Tracey Bedford [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, October 10, 2002 8:22 PM
> To: [EMAIL PROTECTED]
> Subject: Printing in while loops
> 
> 
> Hi Everyone,
> 
> I am new to this list and have a strange question for you.
> 
> I am calling a subroutine in a while loop. However in the output only
> one line is printed.  If I print to screen all information prints out.
> 
> Here is the code
> 
> The line print "$tmp[0]\n"; prints all out put to screen.
> 
> 
> 
> opendir DIR, $dir;
>         while ($file = readdir DIR) {
>                 next if $file !~ /$date\-\d{6}\.general/;
>         open LOGFILE, "$dir/$file" or die "Can't open 
> $dir/$file :$!\n";
> 
>         while (<LOGFILE>) {
> 
>         $tmp = <LOGFILE>;
> 
>         next if $tmp !~ /were not handled on loop/;
> 
> 
>                 @tmp = split (/Items\:/,$_);
>                 $tmp[0] =~ s/\:/\ /g;
>                 $tmp[0] =~ s/jobId\[/\ /g;
>                 $tmp[0] =~ s/\]/\ /g;
>                 $tmp[0] =~ s/\[/\ /g;
>                 print "$tmp[0]\n";
> 
>         if ($errorlist) {
>                 &ProcessEmail;
>         else {exit;}
> 
>         }
> 
> }
>         close LOGFILE;
> 
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to