in reply to Quicksort trubbles.
my (@less, @equal, @greater, @answer);
It would also inform you that you misspelled @equal in:
Fixing those two problems and adding a print statement at the end yields:unshift(@answer, @equal); # was @equals
My pivot is 5 My pivot is 3 My pivot is 6 answer: 9 6 5 4 3 1
Btw, I don't know why you feel you have to use (shift @copy) in your pushes. You can achieve the same thing with the much simpler:
if ($_ < $pivot) { push(@less, $_); } if ($_ == $pivot) { push(@equal, $_); } # etc...
|
|---|