GrandFather has asked for the wisdom of the Perl Monks concerning the following question:
In sample code for Tk::MatchEntry there is code similar to this fragment:
my @choices = [qw/one two three four/]; my $me = $mw->MatchEntry(-choices => @choices);
However this also works:
my @choices = (qw/one two three four/); my $me = $mw->MatchEntry(-choices => \@choices);
as does this:
my $choices = [qw/one two three four/]; my $me = $mw->MatchEntry(-choices => \@$choices);
While I think I understand what the last two variants are doing, I'm a little fuzzy on the first one - is it assigning an anonymous array to element 0 of @choices, or is something else going on? Is there any significant difference between each of the techniques?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Passing arrays and references to arrays
by davorg (Chancellor) on Aug 10, 2005 at 11:23 UTC | |
by GrandFather (Saint) on Aug 10, 2005 at 20:39 UTC | |
|
Re: Passing arrays and references to arrays
by Taulmarill (Deacon) on Aug 10, 2005 at 11:01 UTC | |
by GrandFather (Saint) on Aug 10, 2005 at 11:10 UTC | |
by simon.proctor (Vicar) on Aug 10, 2005 at 11:46 UTC |