Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
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 romping around the Monastery: (3)
As of 2014-10-25 07:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (142 votes), past polls