princepawn has asked for the wisdom of the Perl Monks concerning the following question:
However, $o and $n are both the same. I want to do a rename($o, $n) but it won't work if both variables are the same. So it seems that a reference is being made to $_instead of a copy being put in $o.ls | perl -lne '$o = $_; s/DOTX/DOT_TEST/; $n = $_; warn "***$o, $n"'
Any idea why?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: [perlrun; perlre] $_ seems aliased instead of copied in assignment... why?
by chromatic (Archbishop) on Oct 23, 2002 at 23:20 UTC | |
|
Re: [perlrun; perlre] $_ seems aliased instead of copied in assignment... why?
by thelenm (Vicar) on Oct 23, 2002 at 17:31 UTC | |
|
Re: [perlrun; perlre] $_ seems aliased instead of copied in assignment... why?
by Aristotle (Chancellor) on Oct 25, 2002 at 23:21 UTC |