Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Calling subroutine with a scalar

by philipbailey (Deacon)
on May 06, 2015 at 18:38 UTC ( #1125883=note: print w/replies, xml ) Need Help??


in reply to Calling subroutine with a scalar

Try

my $res = new Some::Package({ foo => bar })->$sub;

Or better:

my $res = Some::Package->new({ foo => bar })->$sub;

Replies are listed 'Best First'.
Re^2: Calling subroutine with a scalar
by Rodster001 (Pilgrim) on May 06, 2015 at 18:53 UTC
    That did it. Thank you. Why is it better to call new that way?

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2022-01-18 16:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (53 votes). Check out past polls.

    Notices?