one-liner to make all programs one-liners

L

Larry

From deep in my secret lab, I have reduced millions of lines of code to
a single line with this =>

s/\n//g and print while <>;

Be very careful...
 
M

Martien Verbruggen

a single line with this =>

s/\n//g and print while <>;

Be very careful...

Indeed. Try this one:

--- begin ---
#!/usr/local/bin/perl
print "Hello World!\n"
--- end ---

And if you insists that the shebang line isn't part of the program:

--- begin ---
# start of program
print "Hello World!\n"
--- end ---

And if you insist that you can't have comments (or pod documentation):

--- begin ---
print "Hello World!
"
--- end --

or worse:

--- begin ---
print <<EOF
Hello World!
EOF
--- end --

And I could probably go on a bit longer, if I felt like it. Line
endings in Perl are not equivalent to "nothing" or even other
whitespace. They are for many intents and purposes, but not nearly for
all.

Martien
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top