Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: print source golf

by Corion (Patriarch)
on Oct 14, 2019 at 16:21 UTC ( [id://11107432]=note: print w/replies, xml ) Need Help??


in reply to print source golf

How about this?

#!perl open 0;print for<0>;

This takes advantage of

  • Single-argument open opens a filehandle *X using the value stored in $X as the filename. Since $0 contains the filename of our program, *0 will be opened as our filehandle.

  • print for<0>; reads from filehandle *0 and prints the content.

Replies are listed 'Best First'.
Re^2: print source golf
by tobyink (Canon) on Oct 14, 2019 at 21:10 UTC

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (3)
As of 2024-04-25 17:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found