in reply to Nested Heredocs and Shell Escapes (code)

Umm, the problem is the test. echo doesn't read stdin! Try
% foo=bar % cat<<EOF >$foo >EOF bar
If you want to preserve the "$foo" do
% foo=bar % cat<<'EOF' >$foo >EOF $foo
--traveler

Replies are listed 'Best First'.
Re: Re: Nested Heredocs and Shell Escapes (code)
by no_slogan (Deacon) on Jun 09, 2001 at 00:01 UTC
    Good call. Perl's << is a bit different from the shell's, so you can't blindly translate print to echo in the perl code
    print <<FOO bar FOO
    This should probably be mentioned in perltrap, but it's not.

    Aside from the quoting issue, it's never going to work the way deprecated seems to want, because environment variables don't get passed from child back to parent. If you want to set variables in your current shell, you need to do something like this:

    $ eval `perl -e 'print "FOO=bar"'` $ echo $FOO bar