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

Replies are listed 'Best First'.
Re^3: 'perl -e' and '__DATA__' What's wrong?
by johngg (Canon) 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?).