in reply to Evaluating variables in here documents

Since you put the EOM in single quotes, the here doc gets treated like a single quoted string (no interpolation). If you put the EOM in double quotes, it gets treated like a double quoted string.

Further Explaination: The quotes you use around EOM determine how it will treat the text.

Replies are listed 'Best First'.
Re: Re: Evaluating variables in here documents
by Hofmator (Curate) on Jan 13, 2003 at 07:56 UTC
    • Single quotes '' treat it like a single quoted string
    ... with small differences in handling backslashes:
    my $var1 = <<'END'; \' $new \' \\ \/ END my $var2 = q/\' $new \' \\ \/ /; print $var1, $var2; # outputs \' $new \' \\ \/ \' $new \' \ /

    -- Hofmator

Re: Re: Evaluating variables in here documents
by Gerard (Pilgrim) on Jan 12, 2003 at 22:19 UTC
    Aha!!! ++ to you. Excellent thanks. Works like a charm.