in reply to Why does my get_max_index function return zero? (High Water Mark Algorithm)
Everything you need is already there:
#!/usr/bin/env perl use strict; use warnings; use feature qw(say); use List::Util qw(max shuffle); use List::MoreUtils qw(onlyidx); use Data::Dump; my @array = shuffle (1..10); dd \@array; my $max = max @array; say $max; say onlyidx {$_== $max} @array; __END__ Karls-Mac-mini:Desktop karl$ ./watermark.pl [7, 10, 9, 8, 2, 6, 4, 3, 5, 1] 10 1
I just cannibalized some fragments i found on my desktop in a hurry. But as far as i remember List::Util and List::MoreUtils come with implementations in pure Perl which might be good for further studies.
Best regards, Karl
«The Crux of the Biscuit is the Apostrophe»
perl -MCrypt::CBC -E 'say Crypt::CBC->new(-key=>'kgb',-cipher=>"Blowfish")->decrypt_hex($ENV{KARL});'Help
|
|---|