3 ms·
Not sure if you've deliberately put in two bugs there haha 1. shift only shifts off the first element. 2. (if classify this as a bug) using $a and $b are frow
by AndrewDavis 1y ago
Not sure if you've deliberately put in two bugs there haha
1. shift only shifts off the first element.
2. (if classify this as a bug) using $a and $b are frowned upon because they're the default variables when using sort.
- jstanley 1y agoHa, (1.) was deliberate but I'd forgotten (2.)
- sshine 1y agoYeah, you probably want my ($x, $y, $z) = @shift; :-D
- rurban 1y agoFor reference: Valid is either sub () { my ($x, $y, $z) = @_; or sub ($x, $y, $z) {
- kqr 1y agoWhy the empty prototype in the first alternative?
- sshine 1y agoI should have said my ($x, $y, $z) = @$_[0]; but I was making a joke. If $_[0] is an array reference, @$_[0] becomes a list. The joke was a reference to most wrong Perl programs being valid for something. Hence the meme: "93% of Paint Splatters are Valid Perl Programs" https://www.mcmillen.dev/sigbovik/ https://www.mcmillen.dev/sigbovik/
- 7952 1y agoOh wow I had forgotten about default variables. Such a lovely and inscrutable idea.