in reply to foreach in array

check if @data really contains the expected number of elements.

make sure that your printed output is distinct (maybe empty string or undef in element).

make sure you use strict and warnings in your scripts

print "elements in \@data: ", scalar( @data ), $/; foreach my $name ( @data ) { print "<$name>"; }

update: quoted @. Thanks GrandFather

Replies are listed 'Best First'.
Re^2: foreach in array
by GrandFather (Saint) on Jul 23, 2008 at 23:59 UTC

    You probably meant to quote the @:

    print "elements in \@data: ", scalar( @data ), $/;

    Perl is environmentally friendly - it saves trees