in reply to single line if conditional

If your version of perl isn't recent, single-line if statements may not work for you.
I would have sworn that statement modifiers were an introduced feature. My mistake.

I notice that you're using a plain string, rather than $name, as the key to the hash. There is nothing syntactically wrong with your snippet, though.

What do you get when you run it?


The PerlMonk tr/// Advocate

Replies are listed 'Best First'.
Re: Re: single line if conditional
by Fletch (Bishop) on Mar 31, 2004 at 16:02 UTC
    If your version of perl isn't recent, single-line if statements may not work for you.

    Well, if by recent you mean a version of Perl >= 1.0. Quoting from perl.man.1 from the 1.0 source:

    Simple statements ... Any simple statement may optionally be followed by a single modifier, just before the terminating semicolon. The possible modifiers are: if EXPR unless EXPR while EXPR until EXPR