#!/usr/bin/env perl
use strict;
use warnings;
use Data::Dump;
sub indexes(&@);
my @array = <DATA>;
chomp @array;
dd \@array;
my @idxs = indexes { $_ eq "bar" } @array;
dd \@idxs;
sub indexes(&@) {
my $test = shift;
grep {
local *_ = \$_[$_];
$test->()
} 0 .. $#_;
}
__DATA__
foo
bar
nose
cuke
foo
bar
nose
cuke
I cheated a little bit from List::MoreUtils.
This stuff isn't so easy - but we grow with our tasks ;-)
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
|