Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

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?



Replies are listed 'Best First'.
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.


      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.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://655658]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (7)
As of 2018-06-24 23:25 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (126 votes). Check out past polls.