On Wed, 13 Dec 2000, tom carlile wrote:

> i'm guessing the tom below is me...?  i'm not that familiar with the [$var]
> syntax, but i do know that perl refs are typically set like $ref = \@arry;
> then, in such an execute call you'd do execute(@{$ref}) to dereference it
> into an array context for execute().  either way it'll work if execute()
> handles arrays -- would execute(@arry) be the same as execute($foo, $bar) ?
> something tells me no?

Oh. For some reason I had the strong impression you were a Perl guru.

Anyways, afaik, execute(@arry) == execute($foo, $bar) if @arry = ($foo,
$bar);

Either way, the subroutine execute() sees @_ == ($foo, $bar).

if you do $ref = [$var] that is equal to $ref = \@array if @array ==
($var). You just don't have to have a variable @array. It's called an
anonymous array IIRC.

Anyways, I think this shows that execute(@array) == execute($foo, $bar):

$a = "foo";
$b = "bar";

@vars = ("foo", "bar");

mysub($a, $b);
mysub(@vars);

sub mysub {
  foreach $x (@_) {
    print "$x\n";
  }
}

The output is:
foo
bar
foo
bar

TIA.

Paul

-- 
The revolution will not be televised.

---------------------------------------------------------------------------
Send administrative requests to [EMAIL PROTECTED]

Reply via email to