Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: To call a sub from another sub

by jonadab (Parson)
on Feb 02, 2006 at 12:19 UTC ( [id://527318]=note: print w/replies, xml ) Need Help??


in reply to Re^2: To call a sub from another sub
in thread To call a sub from another sub

Yes, it'll work just fine. It will even work if the outer subroutine is a lexical closure and passes the other subroutine one of the lexically-retained references it is holding, like this:
sub :: {return lc pop} sub jonadab { my $lex = shift; @ARGV=qw(http://); return sub{ my ($ical) = @_; my $closure = :: $lex.".".$ical."/".$/; }} my $foo = jonadab("PerlMonks"); $\=$foo->("Org"); print shift;

Note: if you turn in code like that for homework, don't expect a good grade.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2024-03-19 08:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found