in reply to Comparing numbers

Just for the sake of doing it differently, and because I so love List::Util. (Thanks to merlyn for mentioning it way back here on PM.) :)
use List::Util qw(reduce); my @num = qw/3.34 3.67 4.75 4.98/; my @diff = map abs($num[$_-1] - $num[$_]), 1 .. $#num; my $maxidx = reduce { $diff[$a] > $diff[$b] ? $a : $b } 0 .. $#diff; print "|$num[$maxidx] - $num[$maxidx+1]| = $diff[$maxidx]\n" if @num > + 1;

Makeshifts last the longest.