in reply to Re: Why isn't this subroutine working?
in thread Why isn't this subroutine working?

Yes, I'm sure. I tried it with, and without the quotes. As for elsf and elsif, I know I've been up most of the night, but I am not hallucinating, eclipse tells me I have a syntax error when I use elsif. Could it be one of the modules I'm using? (I'm using strict, HTTP::Date, XML::DOM, CGI). PS: I am using eclipse on Windows Vista, but the programs run on a Linux server. I have not figured out, yet, how to run and debug perl on the Eclipse IDE on Vista
  • Comment on Re^2: Why isn't this subroutine working?

Replies are listed 'Best First'.
Re^3: Why isn't this subroutine working?
by Corion (Patriarch) on May 20, 2009 at 12:44 UTC

    It might have gone by you - JavaFan's question was more rhetorical, as the differences in output of the following code show you:

    use strict; my $rowRef = { foo => 'foo value', bar => 'bar value', }; my $rowName = 'bar'; for my $rn ($rowName, '$rowName') { my $rowValue; if (exists $rowRef->{$rn}) { $rowValue = $rowRef->{$rn} } else { $rowValue = '<does not exist>'; }; print "rowRef for '$rn' is '$rowValue'\n"; };
      OK, pick on the newbie :-) I was using it without quotes, but then I decided to try it with quotes (I use those for Perl-embedded MySQL code), and that's what I copied and pasted. In any case, even without the quotes, it still does not work.
        Of course not, elsf isn't perl ;->)
Re^3: Why isn't this subroutine working?
by ikegami (Patriarch) on May 20, 2009 at 14:39 UTC

    Then you are misinterpreting the error message. For example,

    >perl -e"while ($x) { if ($y) { } } elsif ($z) { } }" syntax error at -e line 1, near "} elsif" Execution of -e aborted due to compilation errors. >perl -e"while ($x) { if ($y) { } elsif ($z) { } }" >

    Replacing elsif with random words is not a suitable bug fix.

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