in reply to 'my' problems

You've got a conditional tacked onto a my-declaration. This has rather unintuitive effects: it contructs a local static variable (in c-speak). This feature/bug is deprecated, and not what you want to do anyway, so you are safe to stick to your second version.

Replies are listed 'Best First'.
Re^2: 'my' problems
by holli (Abbot) on May 23, 2005 at 10:34 UTC
    Is this also true for ternary conditionals? I use stuff like
    my $var = $condition ? "a" : "b";
    all the time and never had any problems.


    holli, /regexed monk/
      I should be more specific, as dave_the_m below: you get problems if you use statement modifiers on a my. AFAIK the ternary conditional is an expression.