If you don't care that the output array is in numerical order (like your desired output), it can be a one-liner - hehehe
#!/usr/bin/perl # http://perlmonks.org/?node_id=1177217 use strict; use warnings; my @ar1 = qw(text1.txt text1a.txt text2.txt text54.txt text1g.txt text54f.txt); my @lastversion = values %{{ map { /(\d+)/, $_ } sort @ar1 }}; print "@lastversion\n";
In reply to Re: Sorting array
by tybalt89
in thread Sorting array
by negativ_m
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |