Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^2: Standard way for displaying a script's output.

by Xiong (Hermit)
on Feb 10, 2012 at 23:05 UTC ( [id://953142]=note: print w/replies, xml ) Need Help??


in reply to Re: Standard way for displaying a script's output.
in thread Standard way for displaying a script's output.

Except that it's legitimate to store data after any __DATA__; even after __END__ in main.

use strict; use warnings; use SelfLoader; sub daily { sleep int rand }; # work work work print plimsoll() if shift; daily; __END__ sub plimsoll { "http://en.wikipedia.org/wiki/Samuel_Plimsoll\n" };
I'm not the guy you kill, I'm the guy you buy. —Michael Clayton

Replies are listed 'Best First'.
Re^3: Standard way for displaying a script's output.
by JavaFan (Canon) on Feb 11, 2012 at 08:43 UTC
    Except that it's legitimate to store data after any __DATA__; even after __END__ in main.
    So what? Don't forget the audience isn't brainless computers, but humans. I believe that most readers of Perlmonks are smarter than the average houseplant, and don't have trouble spotting the difference between a program that tries to be Miss Smartypants by reading data after an __END__ token, and a program that has its output after an __END__.
      Yes, but the point might have been you cannot mix both input and output in this way.

        Sure you can, that is why each code tags section gets its own download link

        my $data = <<'<<DATA'; Dont you put me after __DATA__ you human <<DATA open my($fh), '<', \$data; while(<$fh>){ print length, "\n"; } __END__
        42

        besides, when human copy/paste, human edit :)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (5)
As of 2024-04-16 05:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found