in reply to Array indices

For the most part you can get by without using indices at all. Here's a version of your code that avoids them.

my @firstnames = qw(john jacob jingle heimer schmidt); my @lastnames = qw(brown black gray greene purple); my @fullnames; for (@firstnames) { push @lastnames, my $lastname = shift @lastnames; push @fullnames, "$_ $lastname"; }

I imagine it may very well be possible to get by without them entirely but it would hardly be worthwhile to try. Retrieving an element in the middle of an array without using indices will always be an O(N) operation but retrieving it by index is O(1).

A good programmer may not need them but a good program often will.

Update: At Limbic~Region's request:

# Save the indices of elements in @search that match $PAT $i++,/$PAT/ and push @indices, $i-1 for @search;

-sauoq
"My two cents aren't worth a dime.";