At first, I was thinking I could support "perl -p" (not in the #! line) giving a helpful message since it is expecting both its script and its input from STDIN. But I immediately thought of using a "TTY" as STDIN such that you can have two "ends of file" on the one STDIN:
shell> stty eof ^Z shell> perl -p >>notes BEGIN { print ''.localtime(),$/ } $_= "$.: $_" CTRL-Z Here are my notes for today. I should really make this a real script. CTRL-Z
But then I realized you can use __END__ to do this trick anywhere:
shell> cat script $_= "$.: $_"; __END__ Testing this. shell> perl -p <script 1: Testing 2: this.
Granted, I haven't come up with a great use of this feature, but I'm reluctant to promote disabling it merely based on my lack of imagination. (:
- tye (but my friends call me "Tye")In reply to (tye)Re: 'perl -p' ne 'cat'
by tye
in thread 'perl -p' ne 'cat'
by grinder
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |