Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Calling subs with &

by monktim (Friar)
on Oct 28, 2003 at 20:49 UTC ( [id://302812]=note: print w/replies, xml ) Need Help??


in reply to Calling subs with &

You can also use & for evil purposes like using reserved words as sub names. It's not bad for obfuscation though.
use strict; &use(); #use(); #this doesn't work sub use { print "In sub\n"; }

Replies are listed 'Best First'.
Re: Calling subs with &
by Abigail-II (Bishop) on Oct 28, 2003 at 22:23 UTC
    It's not bad for obfuscation though.
    package Just_another_Perl_Hacker; sub print {($_=$_[0])=~ s/_/ /g; print } sub __PACKAGE__ { & print ( __PACKAGE__)} & __PACKAGE__ ( )

    Abigail

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (9)
As of 2024-03-28 18:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found