Created
October 10, 2011 05:29
-
-
Save ctfliblime/1274678 to your computer and use it in GitHub Desktop.
Writing Perl as Perl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.