johnnywang has asked for the wisdom of the Perl Monks concerning the following question:
But how to pass the parameter without introducing the variable $ref (i.e., something like \&test->(1))? And how to pass parameters to anonymous subs? Thanks.my $ref = \&test; $ref->(1); sub test{ print "param: ", shift,"\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to pass parameters to anonymous subs and sub references?
by jdporter (Paladin) on Nov 08, 2004 at 19:41 UTC | |
|
Re: How to pass parameters to anonymous subs and sub references?
by BrowserUk (Patriarch) on Nov 08, 2004 at 19:47 UTC | |
|
Re: How to pass parameters to anonymous subs and sub references?
by pg (Canon) on Nov 08, 2004 at 19:50 UTC | |
|
Re: How to pass parameters to anonymous subs and sub references?
by Arunbear (Prior) on Nov 08, 2004 at 19:52 UTC | |
|
Re: How to pass parameters to anonymous subs and sub references?
by NetWallah (Canon) on Nov 08, 2004 at 22:10 UTC |