fork(1) download
  1. #!/usr/bin/perl
  2. use strict;
  3. use warnings;
  4.  
  5. use version;
  6. use List::Util qw(reduce);
  7.  
  8. my @v = ("0.039", "0.035");
  9. my $max;
  10.  
  11. $max = reduce { version->parse($a) > version->parse($b) ? $a : $b } @v;
  12. printf "%s\n", $max // 'UNDEF';
  13.  
  14. $max = reduce { version->parse("$a") > version->parse("$b") ? $a : $b } @v;
  15. printf "%s\n", $max // 'UNDEF';
  16.  
Success #stdin #stdout 0s 3900KB
stdin
Standard input is empty
stdout
UNDEF
0.039