my @zeilen=(); open (FILE, '<', '/tmp/testdat.txt') or die "Fehler beim öffnen der Datei : $!"; while() { print $_; /^([^;]*;){2}([^;]*)/; #separate content of column three push (@zeilen, [$_,$2]); #initialize ,2d array -> [0]=whole line, [1]content of column three } close (FILE); my $first_line=shift(@zeilen); #store first line @zeilen=sort{$a->[1] <=> $b->[1]}@zeilen; #sort unshift(@zeilen, $first_line); #add first line print "\n----------\n\n"; for my $zeile (@zeilen) {print $zeile->[0]}