On 2011-11-25 01:08, John W. Krahn wrote:

Or use:

close SOCKET || die "close: $!";

Instead of the more correct:

close SOCKET or die "close: $!";

Well, close takes exactly 1 parameter, so the first variant is working correctly.

perl -MO=Deparse -e '
  close( SOCKET || die "amai" )
'
close SOCKET;
-e syntax OK

The code can start to fail if Perl would change the signature of close().
This is a nice example of why it is hard to remain backwards compatible.
By having the signature of close as it is, it can't be changed without making "wrongly styled" code fail.

I also prefer to code it with 'or', and without using parens.

--
Ruud
https://en.wiktionary.org/wiki/amai

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to