Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Passing array to a subroutine

by 1nickt (Monsignor)
on Sep 13, 2017 at 13:44 UTC ( #1199303=note: print w/replies, xml ) Need Help??


in reply to Passing array to a subroutine

Pass a reference to the array instead:

$t->sadk_flap_mx_ifd_laser( ifd => \@child_interfaces, flap => $flaps +);
Then dereference it in the subroutine:
sub sadk_flap_mx_ifd_laser { my %args = @_; my @child_interfaces = @{ $args{'ifd'} }; my $flap = $args{'flap'}; ... }

Hope this helps!

Update: removed unrelated link to perldsc, the correct doc is perlreftut as pointed out below by haukex.


The way forward always starts with a minimal test.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1199303]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2018-07-21 08:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (445 votes). Check out past polls.

    Notices?