in reply to Inconsistencies between Perl versions

Now, line 120 is the start of one of my subroutines, which contains a foreach loop, and very little else (see below for code). The loop variable does, in fact, have a $, and this error seemed bizzare, all the more so because this didn't come up during previous testing.
It's right that it's an error in that ancient Perl, although the error is misleading.

The "my" on a foreach loop variable wasn't introduced until either 5.4 or 5.5 (I don't recall which). The error message was reporting a syntax error from the perspective of Perl 5.1, which just had no clue about such syntax.

And how in the world are you still running 5.1? There are known security holes in that code! I hope you're not facing the internet with a CGI script running that version.

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.

  • Comment on •Re: Inconsistencies between Perl versions

Replies are listed 'Best First'.
Re: •Re: Inconsistencies between Perl versions
by Tanalis (Curate) on Apr 30, 2003 at 09:34 UTC
    And how in the world are you still running 5.1? There are known security holes in that code! I hope you're not facing the internet with a CGI script running that version.

    Well, we're using a combination of 5.001 and 5.004 - I guess it's seen as easier to keep legacy scripts working, rather than risk an upgrade and having misson-critical scripts fail. To be honest, I don't know :)

    We're not using it for CGI, it's all internal, in-house scripting basically just to munge some data and dump out reports.

    Thanks for the reply, though, I didn't know "my" on a foreach was introduced so recently :)

    -- Foxcub
    A friend is someone who can see straight through you, yet still enjoy the view. (Anon)

      I guess it's seen as easier to keep legacy scripts working, rather than risk an upgrade and having misson-critical scripts fail.

      Tell us that again after you've had to deal with the aftermath of someone taking advantage of one of the n-plus year old holes.

      Of course I'm terrible about changing the oil in my car, so I don't have much room to lecture on the virtue of preventiveness. :)