in reply to Sorting array
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";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Sorting array
by negativ_m (Novice) on Dec 06, 2016 at 13:19 UTC | |
by poj (Abbot) on Dec 06, 2016 at 13:55 UTC | |
by tybalt89 (Monsignor) on Dec 06, 2016 at 17:56 UTC |