Skip to content

Instantly share code, notes, and snippets.

@paveljurca
Created December 14, 2015 18:18
Show Gist options
  • Save paveljurca/3571ed6288d33b8b70d1 to your computer and use it in GitHub Desktop.
Save paveljurca/3571ed6288d33b8b70d1 to your computer and use it in GitHub Desktop.
use strict;
use warnings;
use v5.10;
for (my $i=1; $i < @ARGV; $i++) {
($ARGV[$i], $ARGV[$i-1]) = ($ARGV[$i-1], $ARGV[$i]) if $ARGV[$i-1] > $ARGV[$i];
}
say $ARGV[-1] || 'no numbers';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment