I have this array of files which looks like this :
my @html_pages_files = ("html.17", "html.9", "html.0", "html.10");
I will put the extension of the file after the sort part. Basically the file name will be /html.\d/. The thing is I'm trying to sort it using map and sort function :
map { $_->[1] }
sort { $a->[0] <=> $b->[0] }
map { /html\.(.*)/; [$1, $_] }
@html_pages_files;
print "@html_pages_files\n";
However the output remains the same as the original array. I've followed step by step @Chas. Owens answer here : Using Perl, how can I sort an array using the value of a number inside each array element?. Note that I'm pretty new to perl so I don't get all the details.
Does anybody seed where the error is ? Thank you!!!
$1will have the value from the previous regex match. I'd change it to/.../ or dieif you expect that it will always pass.