#!/usr/bin/perl use strict; my @names = qw (Patch_8.0 Patch_9.3 Patch_10.2 Patch_1.0 Patch_2.0 Pat +ch_3.1 Patch_5.0 Patch_4.2 Patch_6.0 Patch_7.0); my @patches = sort { my ($A) = $a=~ m/([\d\.]+)/; my ($B) = $b=~ m/([\d\.]+)/; $A <=> $B}@names; print "$_\n" for @patches; __END__ Patch_1.0 Patch_2.0 Patch_3.1 Patch_4.2 Patch_5.0 Patch_6.0 Patch_7.0 Patch_8.0 Patch_9.3 Patch_10.2
In reply to Re: sorting an array with decimal points
by Marshall
in thread sorting an array with decimal points
by levW
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |