http://www.perlmonks.org?node_id=1047680


in reply to how to refer the index of an array to another array of the same length

I think you need a C-style for loop, to keep track of the array index. Something like this:

for my $i (0 .. $#cg) { my $g = $cg[$i]; if ($g eq $gl[$i]) { push @ind, $g; print N "$g\n"; print S "$csta[$i]\n"; } }

Is that what you’re looking for? If not, please specify sample input (the contents of the arrays) together with the output you expect.

Hope that helps,

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,