in reply to How does my work with a trailing conditional

ikegami is correct in that the syntax under question is documented as having undefined behavior.

That said, the way it generally behaves is:

Generally, this trick is used to declare and initialize static variables within functions. Your second try is much better and cleaner, anyways.

Replies are listed 'Best First'.
Re^2: How does my work with a trailing conditional
by dave_the_m (Monsignor) on Apr 21, 2005 at 19:03 UTC
    The run-time behavior will assign the value on the RHS of the operator to $string.
    The important run-time behaviour of my is to make a note to release the scalar on scope exit. Thus  my $foo if $false means that the var isn't released at the end of the block, making the value still available at the next entry to the block.

    Dave.