Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re: Returning multiple values from a subroutine

by vinoth.ree (Monsignor)
on Dec 28, 2012 at 11:49 UTC ( #1010692=note: print w/replies, xml ) Need Help??

in reply to Returning multiple values from a subroutine

Hi, You are returning an Array reference and scalar reference, but the value get assigned into an array, So both the returning reference saved into @subs array


change the code as

my ( $subs, $SubId ) = getsubsFromAcct( $currAcct ); my $length = @$subs; print ("No of subs : $length and subs are @$subs");

Replies are listed 'Best First'.
Re^2: Returning multiple values from a subroutine
by rkrish (Acolyte) on Dec 28, 2012 at 12:33 UTC

    Thanks for the quick reply :) it worked

      I'm glad it does. However, what I find more interesting is whether you understand why it works. References can be a tough subject to grasp. But you do, it's an immensely powerful tool that you should be glad to have in your toolbox. So are you just taking ree's solution as-is, happy it solves your problem, or do you see what he did and how that works?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1010692]
[jdporter]: I guess that the most direct way of doing it is with some magical incantation involving unpack or whatever
[jdporter]: let me google that for me ;-)
[jdporter]: hex points explicitly to oct, which does the job. :-D
[jdporter]: omg, I f love Perl!
[choroba]: say unpack 'H*', pack 'B*', $mask =~ /0b([01]+)/;
[choroba]: use C instead of H to get the decimal number
[erix]: ( no love like f love )
[choroba]: f* love

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (9)
As of 2018-02-20 16:34 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (272 votes). Check out past polls.