in reply to Compilation Error

what's the error? Where are $cl, @data, and %data declared?

Replies are listed 'Best First'.
Re^2: Compilation Error
by Snowman11 (Novice) on Jun 28, 2005 at 16:17 UTC
    i get Goblal symbol "c1" requires an package name.
      $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;