Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

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

by Skeeve (Vicar)
on Dec 07, 2007 at 09:57 UTC ( #655615=note: print w/replies, xml ) Need Help??

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

Unfortunately <<'EOT' has the same limitations as using <<<, meaning: STDIN is already used for the script and so I can't pipe other content in.

My current solution is, that I use a variable like this:

my $DATAvar = <<'EOT'; example data here EOT


Replies are listed 'Best First'.
Re^3: 'perl -e' and '__DATA__' What's wrong?
by johngg (Abbot) on Dec 07, 2007 at 14:29 UTC
    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?



      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?).

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2017-12-12 22:59 GMT
Find Nodes?
    Voting Booth?
    What programming language do you hate the most?

    Results (340 votes). Check out past polls.