#!/usr/bin/perl -w # Una possibile implementazione per il quicksort use strict; my(@arrayInt, @tot); @arrayInt = (4, 2, 5, 1, 5, 6); sub insert { my ($el, $fel, @rlist, $i); ($el, $fel, @rlist) = @_; if ($el <= $fel) { return ($el, $fel, @rlist); } else { return ($fel, insert($el, @rlist)); } } sub insertsort { my ($el, @list); if (@_ <= 1) { return @_ } ($el, @list) = @_; return(insert($el, insertsort(@list))); } @tot = insertsort(@arrayInt); print "Ordinato: @tot\n";