Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

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

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


Comment on Re^2: 'perl -e' and '__DATA__' What's wrong?
Select or Download Code
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?

    Cheers,

    JohnGG

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

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (7)
As of 2014-12-28 07:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (179 votes), past polls