in reply to Why is the error thrown from close(FH) when the error is the missing <> on while(FH)?
This doesn't produce an error:
Nor does this:my $fname = 'data.txt'; open FH, "<", $fname or die "Couldn't open $fname: $!"; while(FH) { print "hello\n"; }
while(FH) { print "hello\n"; }
According to "Perl Best Practices", p. 65:
In Perl, any identifier that the compiler doesn't recognize as a subroutine (or as package name or filehandle or label or builtin function) is treated as an unquoted character string:
I'm not sure why there are parentheses around "or package name or filehandle..." because the section is not about subroutines. And it should say, "...is treated as a string".$greeting = Hello . World; print $greeting, "\n"; #Prints: HelloWorld
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Why is the error thrown from close(FH) when the error is the missing <> on while(FH)?
by parv (Parson) on Feb 01, 2013 at 06:45 UTC | |
by 7stud (Deacon) on Feb 01, 2013 at 06:48 UTC |
In Section
Seekers of Perl Wisdom