On 12 Jun 2001 12:38:48 -0400, John Pimentel wrote:
> Forgive me if I'm missing something, but I've used the following:
>  $varnew = "$varold" ;
> 
> $varnew will return the same value as $varold did/does.
> 
> Just like if you wanted to initialize a bunch of counters: $ctr1 = $ctr2 =
> $ctr3 = $ctr4 = 1;  .
> 
> I don't know that it is proper form, but it seems to work.
<snip />

This is double plus ungood.  $varnew = "$varold"; says that the scalar
value in $varold make it into a string and then assign that string to
$varnew.  First off the double quotes are unessessary for the simple
cases:

my $varold = 5;
my $varnew = "$varold"; #this is equal to $varnew = "5", 
                        #how is this better than $varnew = $varold;? 

Second it is downright terrible in the complex cases;

my $old = new Object;
my $new = "$old";  #$new is now equal to "Object=HASH(0x80f8a20)" 

--
Today is Pungenday, the 17th day of Confusion in the YOLD 3167
Hail Eris, Hack Linux!


Reply via email to