Re: assign a left hand variable to a variable

From: Tore Aursand (tore_at_aursand.no)
Date: 09/30/04


Date: Thu, 30 Sep 2004 10:37:38 +0200

On Thu, 30 Sep 2004 00:44:15 -0700, justme wrote:
> how do i assign a left hand side variable to a variable. For example
>
>
> for($count = 0; $count < @array; $count++ )
> {
> $h = $somevariable->somemethod(args,args);
> }
>
> i want to have something like this:
>
> $h0 = $somevariable->somemethod(args,args);
> $h1 = $somevariable->somemethod(args,args);
> $h3 = $somevariable->somemethod(args,args);
> .....
>
> How to "append" the numbers to $h ? thanks in advance.

You most probably won't do that [1], and you're anyway better off using an
array, as far as I can see;

  for ( 0..$#array ) {
      $h[$_] = ....;
  }

-- 
Tore Aursand <tore@aursand.no>
"Why shouldn't truth be stranger than fiction? Fiction, after all, has
 to make sense." (Mark Twain)


Relevant Pages