Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Weird array printing/passing to subroutine problem

by ahunter (Monk)
on Jul 10, 2000 at 21:37 UTC ( #21829=note: print w/ replies, xml ) Need Help??


in reply to Weird array printing/passing to subroutine problem

I'm surprised no-one has suggested it yet, but you can use prototyping to force things to happen the way you want:

sub my_sub (\@$) { my $array = shift; my $scalar = shift; # $array is a reference to the array # $scalar is the next argument } my_sub @array, "scalar";
Perl will automagically change @array into a reference for you. See perlsub for more information about prototyping.

Andrew.


Comment on Re: Weird array printing/passing to subroutine problem
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (8)
As of 2014-10-01 23:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    What is your favourite meta-syntactic variable name?














    Results (41 votes), past polls