#!/usr/bin/perl sub quicksorty{ my @list = @_; my @copy = @list; my $length = @list; my @less, @equal, @greater, @answer; if ($length <= 1){ return @list; } my $pivot = $list[0]; print "My pivot is $pivot\n"; foreach (@list){ if ($_ < $pivot){ push(@less, (shift @copy )); } if ($_ == $pivot){ push(@equal, (shift @copy)); } if ($_ > $pivot){ push(@greater, (shift @copy)); } } unshift(@answer, quicksorty(@less)); unshift(@answer, @equals); unshift(@answer, quicksorty(@greater)); return @answer; } quicksorty(5,3,1,6,4,9);