http://www.perlmonks.org?node_id=993420


in reply to Re^2: Compare elements of a line in a file
in thread Compare elements of a line in a file

So, based on the code you posted in response to Dave, you should be able to replace your foreach loop with:
foreach (sort keys %h) { @n = split /\t/, $h{$_}; map {say if $_ > $last+50; $last = $_} @n; }