in reply to Re^2: Pearls (not really) of Perl programming
in thread Pearls (not really) of Perl programming
This seems to rely on luck as the block may yield "" which sort is not advertised to accept.That code always returns 1 or -1 AFAICT. Can you explain?
Update: it will return false if $a or $b isn't any of the types tested for, but false isn't "", it's both 0 and "":
$ perl -we'@_ = sort { "" } 1,2' Sort subroutine didn't return a numeric value at -e line 1. $ perl -we'@_ = sort { !1 } 1,2'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Pearls (not really) of Perl programming
by rir (Vicar) on Nov 29, 2004 at 18:28 UTC | |
|
Re^4: Pearls (not really) of Perl programming
by Courage (Parson) on Dec 01, 2004 at 15:21 UTC | |
by htoug (Deacon) on Dec 01, 2004 at 18:49 UTC | |
by Courage (Parson) on Dec 01, 2004 at 23:35 UTC | |
by ysth (Canon) on Dec 01, 2004 at 16:49 UTC |