in reply to Sorting @lines
Use a hash to cache your numbered values part and sort based on the keys.#!/usr/local/bin/perl -w use strict; my @stuff = qw (124.43.adsf.ca 235.23.aer.ca 100.34.asdm.ca); my %hash = map { $_, m{(\d+(?:\.\d+)*)} } @stuff; @stuff = sort {$hash{$a} <=> $hash{$b}} keys %hash; print join "\n", @stuff;
|
|---|