Skip to content

Instantly share code, notes, and snippets.

@ctfliblime
Created October 10, 2011 05:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ctfliblime/1274678 to your computer and use it in GitHub Desktop.
Save ctfliblime/1274678 to your computer and use it in GitHub Desktop.
Writing Perl as Perl
#!/usr/bin/env perl
use 5.014;
my @table=(1,2,3,8,5,8,0,4);
my $max = pop [sort @table];
my @places;
while (my ($index, $value) = (each @table)) {
push @places, $index if $value == $max;
}
say sprintf 'Max value is %d, at position(s) %s.', $max, join(', ', @places);
@MaximeD
Copy link

MaximeD commented Oct 10, 2011

Pretty ! Could you report if it works on your system ? I have a doubt about a few things and since perl 5.14 is not installed on my computer, I can't try it at home.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment