in reply to foreach in array

You must be mistaken about the contents of your array. foreach doesn't skip elements.

my @data = qw( foo bar baz moo mar ); print("1st - 0 - $data[0]\n"); print("5th - 4 - $data[4]\n"); print("\n"); foreach $name (@data) { print "$name\n"; }
1st - 0 - foo 5th - 4 - mar foo bar baz moo mar

A good way of determining the contents of an arbitrarily complex data structure (or a simple array) is to use Data::Dumper.

use Data::Dumper; my @data = qw( foo bar baz moo mar ); print(Dumper(\@data));
$VAR1 = [ 'foo', 'bar', 'baz', 'moo', 'mar' ];

By the way, the language is called "Perl", not "PERL".