Monty wrote:
I've come across the following bit of code:

print PIPE "This is line number $_\n" and $count++;

This will only increment $count if print returned a "true" value.


How does this differ from:

print PIPE "This is line number $_\n";
$count++;

This will always increment $count.


What you probably want is:

print PIPE "This is line number $_\n" or die "Cannot print to pipe: $!";
$count++;



John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order.                            -- Larry Wall

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to