Mega Code Archive

 
Categories / Perl / Array
 

The sort command sorts an array

#!/usr/bin/perl -w @array = ('red', 'green', 'blue', 'orange', 'maroon'); print "Before: @array\n"; @sorted = sort(@array); print "After:  @sorted\n";