$VAR1 = [ \'830974\', \'722065\', \'722046\', \'716963\' ];
How can I calculate the array index for
Here is how you would find all the positions at which a given value appears:
#!/usr/bin/perl use strict; use warnings; my @x = ( 1, 2, 3, 3, 2, 1, 1, 2, 3, 3, 2, 1 ); my @i = grep { $x[$_] == 3 } 0 .. $#x; print "@i\n";
If you only need the first index, you should use List::MoreUtils::first_index.