in reply to Re: Compilation Error
in thread Compilation Error

i get Goblal symbol "c1" requires an package name.

Replies are listed 'Best First'.
Re^3: Compilation Error
by davidrw (Prior) on Jun 28, 2005 at 16:24 UTC
    $c1 needs to be declared. you could just put my $c1; before your for loop, or do for (my $c1 = 0; ... ){. But you can also rewrite that loop to make it more "perlish" (enter TMTOWTDI -- all of these do the same thing):
    foreach my $c1 ( 0.. $#data ){ print $data[$c1]{value} . "\n"; } foreach ( 0.. $#data ){ print $data[$_]{value} . "\n"; } print $data[$_]{value} . "\n" for 0 .. $#data; print $_{value} . "\n" for @data; print map { $_{value} . "\n" } @data;