Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
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 scrutinizing the Monastery: (5)
As of 2015-04-19 22:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Who makes your decisions?







    Results (362 votes), past polls