use strict; use warnings; my ($c, @data); while () { chomp; $data[$c++] = [split /\|/]; } print join('|', @$_) . "\n" for (sort {@$a[0] <=> @$b[0]} @data); __DATA__ 30|microsoft 70|aol 76|netscape 35|mozilla 40|opera