Highlights
All Snippets
Top 100 Snippets
Librarians
gbCodeLib

By Language
VB6
JavaScript
Perl
HTML
SQL
Java
DOS

GBIC >> Source Code >> Perl >> Snippet

sort on several fields


$sorted = sort { field1( $a ) <=> field1( $b ) ||           # see PerlFAQ on this
                field2( $a ) cmp field2( $b ) ||
                field3( $a ) cmp field3( $b )
               }      @data ;