goodgulf has asked for the wisdom of the Perl Monks concerning the following question:
Note that the following replacement code (explicit to the max) works without incident. Why are the two not identical? Programming Perl/3e, pg. 81 claims that the first line should work. So, what gives?:Code: print "Before fubar\n" . Dumper(@g::TaskList); $Body .= "$_<br>" while(<LOG>); print "After fubar\n" . Dumper(@g::TaskList); Output: Before fubar $VAR1 = 'Localize'; $VAR2 = 'ErrorCheck'; After fubar $VAR1 = undef; $VAR2 = 'ErrorCheck';
Also, a check of the memory locations of $Body and @g::TaskList showed them to be "miles" apart, and not altered by the code, in case you were curious. Thanks muchly for any insight.Working (identical?) version: while (my $line = <LOG>) { $Body .= "${line}<br>"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Side Effects
by Tanktalus (Canon) on Apr 07, 2005 at 00:00 UTC | |
by ysth (Canon) on Apr 07, 2005 at 04:21 UTC | |
|
Re: Side Effects
by ikegami (Patriarch) on Apr 07, 2005 at 04:18 UTC | |
by goodgulf (Initiate) on Apr 07, 2005 at 19:50 UTC | |
by ikegami (Patriarch) on Apr 07, 2005 at 19:57 UTC | |
by goodgulf (Initiate) on Apr 07, 2005 at 20:18 UTC | |
|
Re: Side Effects
by dragonchild (Archbishop) on Apr 07, 2005 at 00:18 UTC | |
|
Re: Side Effects
by tlm (Prior) on Apr 06, 2005 at 23:53 UTC |