in reply to Version list with min and max
You should take a look at the version module. It gives you standard comparison operators so you can just do this:
use version; my $max = qv( "3.0.0.0" ); my $min = qv( "2.0.0.0" ); my @versions = ( qv("1.0.0.0"), qv("1.1.10.1"), qv("2.0.0.0"), qv("2.1.0.0"), qv("10.6.1.0"), ); my @constrained_versions = grep { $max >= $_ and $min <= $_ } @versions; print "@constrained_versions\n";
TGI says moo
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Version list with min and max
by ikegami (Patriarch) on Feb 23, 2008 at 03:07 UTC |