Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Passing arrays and references to arrays

by Taulmarill (Deacon)
on Aug 10, 2005 at 11:01 UTC ( [id://482565]=note: print w/replies, xml ) Need Help??


in reply to Passing arrays and references to arrays

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?

i think so, too. but if you don't trust yourself, go on and use Data::Dumper to find out.
i don't see a difference between these three techniques from the called funktion point of view. however, i would do this a bit different:
my $choices = [qw/one two three four/]; my $me = $mw->MatchEntry(-choices => $choices);
or did i miss some obvious reason why that wouldn't work?

Replies are listed 'Best First'.
Re^2: Passing arrays and references to arrays
by GrandFather (Saint) on Aug 10, 2005 at 11:10 UTC

    It does work. Variant number 4 :). Guess I was array fixated by the first two variants.


    Perl is Huffman encoded by design.
      If I understand everything correctly then I don't think this is a fourth variant:
      \@$choices
      compared to
      $choices
      I think you need to look up array refs and pay particular attention to referencing and dereferencing. In both cases you have an array ref, however in the first you deref it only to then make it a reference again. The second doesn't do this unneccessary merry go round.

      HTH.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://482565]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (3)
As of 2024-03-29 01:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found