Snowman11 has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: Compilation Error
by Nevtlathiel (Friar) on Jun 28, 2005 at 16:12 UTC
    You just need to declare my $cl and my %data before you use them (and in the smallest scope possible, read this article if you're not sure about scope) :)

    ----------
    My cow-orkers were talking in punctuation the other day. What disturbed me most was that I understood it.

Re: Compilation Error
by davidrw (Prior) on Jun 28, 2005 at 16:11 UTC
    what's the error? Where are $cl, @data, and %data declared?
      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;
Re: Compilation Error
by Fletch (Bishop) on Jun 28, 2005 at 16:38 UTC

    Not to mention that if($data{value} eq  "" || null) isn't going to do anything meaningful. It parses out as if ((($data{'value'} eq '') or 'null')). What you would want to do would be to check if it's defined or not.

    And given this is just a small smippet out of context I don't even want to get into what horrors of recursive calling could be brought on with that &adduser; line judging from the comment (aside from the fact that you really don't want to call a sub like that (ampersand with no parens) unless you know why you're doing it that way; just call mysub()).

    --
    We're looking for people in ATL