in reply to Re: substr sort ??
in thread substr sort ??

Since the input data appear to be delimitted by the "=", using a split to generate the sort key might be more robust:
#!/usr/bin/perl use warnings; use strict; my @values = ( '123=more digits', '04=critical', '02=informational', '01=unknown', '10=test', '03=warning', '08=foo', ); @values = map { $_->[1] } sort { $a->[0] <=> $b->[0] } map { [ ( split /=/ )[0], $_ ] } @values; print "@values\n";
output = 01=unknown 02=informational 03=warning 04=critical 08=foo 10=test 123=more digits