Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^3: 'perl -e' and '__DATA__' What's wrong?

by johngg (Abbot)
on Dec 07, 2007 at 14:29 UTC ( #655658=note: print w/ replies, xml ) Need Help??


in reply to Re^2: 'perl -e' and '__DATA__' What's wrong?
in thread 'perl -e' and '__DATA__' What's wrong?

STDIN is already used for the script and so I can't pipe other content in

I'm probably misunderstanding something but

$ cat cccc zzz 999 $ cat cccc | perl -e ' > print <<'EOT'; > abc > 123 > EOT > print while <>;' abc 123 zzz 999 $

I can read from STDIN here. Have I got the wrong end of the stick?

Cheers,

JohnGG


Comment on Re^3: 'perl -e' and '__DATA__' What's wrong?
Select or Download Code
Re^4: 'perl -e' and '__DATA__' What's wrong?
by Skeeve (Vicar) on Dec 07, 2007 at 14:47 UTC
    That's exactly what I needed with additional __DATA__. Now replace -e with <<< or with the <<'EOT' proposed and you'll see what I meant.

    s$$([},&%#}/&/]+}%&{})*;#$&&s&&$^X.($'^"%]=\&(|?*{%
    +.+=%;.#_}\&"^"-+%*).}%:##%}={~=~:.")&e&&s""`$''`"e

      I don't get it. Are you saying that there's still a problem here? I think it's been made clear that __DATA__ isn't available from a -e script and why. If you need some extra data, just store it in a scalar or an array and use that (why bother with reading another filehandle?).

        okay then...

        Just again in slow motion...

        My script is part of an AppleScript.

        The perl script needs:

        1. STDIN or Filenames given on Commandline, read with the magic <>
        2. __DATA__

        Why _DATA__? Because I want to feed it some stuff whose content I don't know. DATA is a quite safe way for doing it, because I don't need to worry about any "dangerous" characters in it.

        Now I use a variable assignment, but i must make sure that the END marker isn't used in the data I want to store.

        So is there a problem?

        Yes, but not a big one.


        s$$([},&%#}/&/]+}%&{})*;#$&&s&&$^X.($'^"%]=\&(|?*{%
        +.+=%;.#_}\&"^"-+%*).}%:##%}={~=~:.")&e&&s""`$''`"e

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2014-07-14 09:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (257 votes), past polls