#!/usr/bin/perl use strict; use diagnostics; use warnings; my $fh; my @lines = (); my @sortedlines = (); open($fh, "<", "filename") or die "I cannot open the file: $!\n"; chomp(@lines = <$fh>); @sortedlines = sort { $b =~ /(^\d*\.*\d+);/ <=> $a =~ /(^\d*\.*\d+);/ } @lines; print "SORTED LINES = @sortedlines\n";