Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: problems passing variables between subroutine

by philiprbrenan (Monk)
on Sep 05, 2012 at 21:36 UTC ( #991952=note: print w/ replies, xml ) Need Help??


in reply to problems passing variables between subroutines

Please use a reference to an array rather than an actual array in:

sub create_output (\@$) { my (@array_of_lines, $entry_no_new) = @_;

as below:

use feature ":5.14"; use warnings FATAL => qw(all); use strict; use Data::Dump qw(dump pp); sub foo(\@) {my ($array) = @_; say "@$array"; } my @array = qw(1 2 3); foo(@array);

Produces

1 2 3


Comment on Re: problems passing variables between subroutine
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (12)
As of 2014-12-18 20:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (61 votes), past polls