> -----Original Message-----
> From: Joshua Chamas [mailto:[EMAIL PROTECTED]]
>
> I don't know that while(<IN>) is a good idea,
> I wonder what would happen if somehow a line
> was blank, would that be boolean 0 ? Try
> instead: for(<IN>), or even
>
> my @lines = <IN>
> for ( @lines ) {
That shouldn't be neccessary. The construct
while (<IN>) {
is a specialcased as a shorthand for
while (defined($_ = <IN>)) {
See `perldoc perlsyn`:
For example, when processing a file like /etc/termcap. If your input
lines
might end in backslashes to indicate continuation, you want to skip ahead
and get the next record.
while (<>) {
chomp;
if (s/\\$//) {
$_ .= <>;
redo unless eof();
}
# now process $_
}
which is Perl short-hand for the more explicitly written version:
LINE: while (defined($line = <ARGV>)) {
chomp($line);
if ($line =~ s/\\$//) {
$line .= <ARGV>;
redo LINE unless eof(); # not eof(ARGV)!
}
# now process $line
}
--
Henrik Tougaard, FOA. Denmark.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]