in reply to Sorting file rows and copy them in an array

Tested code, employing the Schwartzian_transform
use warnings; use strict; use Data::Dumper; my @lines; chomp(@lines = <DATA>); my @sortedlines = map { $_->[0] } sort { $a->[1] <=> $b->[1] } map { [ $_, (split /;/)[0] ] } @lines; print Dumper(\@sortedlines); __DATA__ .0000000001;2;1;.5;.2 .5;2;1;.5;.5 0.3;1.5;.5;.5;.2 1;1;.7;1;1 .4;1;.4;1;.5

Outputs:

$VAR1 = [ '.0000000001;2;1;.5;.2', '0.3;1.5;.5;.5;.2', '.4;1;.4;1;.5', '.5;2;1;.5;.5', '1;1;.7;1;1' ];

See also:

Replies are listed 'Best First'.
Re^2: Sorting file rows and copy them in an array
by savio (Initiate) on Dec 11, 2014 at 18:01 UTC
    Ok thank you to all for answers.