in reply to Re: Some questions about CGI and optimizing Perl
in thread Some questions about CGI and optimizing Perl
One problem:
$x = shift || 4;
What happens if you really want to pass 0 in? It just won't work. So you still end up with a defined test (or apply the "defined or" patch):
$x = shift; $x = defined $x ? $x : 4; # Or with the "defined or" patch $x = shift // 4; # Or check if there is anything left on @_ and shift if there is $x = @_ ? shift : 4;
"There is no shame in being self-taught, only in not trying to learn in the first place." -- Atrus, Myst: The Book of D'ni.
|
|---|