Keep It Simple, Stupid | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I think the question of when references to subs are used and anonymous subs are used is too broad.
Here is a simple example of anonymous sub -
In the above block we passed an anonymous sub to sort. It is just easy (convenient) to write numeric sort that way than to define a sub that returns $a <=> $b An example of sub ref is signal handling
These examples are very simple. Others might contribute better examplese. Another thing i can think of is closures where you return a reference to a sub from inside another sub. -SK In reply to Re: reference to a sub
by sk
|
|