From: Paul <[EMAIL PROTECTED]> > --- Rob Dixon <[EMAIL PROTECTED]> wrote: > > > NOTE: The behaviour of a "my" statement modified with a > > > statement modifier conditional or loop construct (e.g. "my $x > > > if ...") is undefined. The value of the "my" variable may be > > > "undef", any previously assigned value, or possibly anything > > > else. Don't rely on it. Future versions of perl might do > > > something different from the version of perl you try it out > > > on. Here be dragons. > > > Stuff like this: > > > > my $x = 1 if 0 == 1; > > > > leaves you not knowing anything about the value in $x. > > Not true, exactly. > As I understand it, I know that > > 1) since the test was false, the my() and assignment > will never be executed. > 2) no my() means any previous value will remain. > any prior value will still be in effect. > > so that if my($x) had previously been assigned with qw/foo bar/, it > will still have the value of 'foo'.
No. What the aforementioned paragraph says is "it can have any value it wants." Do not try to give this a meaning, it simply doesn't have any. It may seem to do something, it may do the same thing always in your Perl, but it may behave differently in a different version/pathlevel, under a different OS, compiled by a different C compiler, ... Replace the whole paragraph with DO NOT DO THIS! in big red letters and you've parsed it. Jenda ===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz ===== When it comes to wine, women and song, wizards are allowed to get drunk and croon as much as they like. -- Terry Pratchett in Sourcery -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]