Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
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 surveying the Monastery: (7)
As of 2016-02-11 02:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How many photographs, souvenirs, artworks, trophies or other decorative objects are displayed in your home?





    Results (358 votes), past polls