in reply to sorting with substrings
use Sort::Key::Multi qw(ii_keysort); # ii => two integer keys my @sorted = ii_keysort { /(\d+)_(\d+)$/ } @data; [download]