mkirank has asked for the wisdom of the Perl Monks concerning the following question:

How do i print as well as store the string to a variable
print $str<<SEPERATOR; This is a string $xyz SEPERATOR

Edit Masem 2002-01-24 - Changed title from "line seperator"

Replies are listed 'Best First'.
Re (tilly) 1: line seperator
by tilly (Archbishop) on Jan 24, 2002 at 18:12 UTC
    You can also print the assignment:
    print $str = <<SEP; This is a string $xyz SEP
    As other people have suggested, you often should be scoping the string with my when you assign it. What that does is well-explained by Dominus in Coping with Scoping.
Re: line seperator
by davis (Vicar) on Jan 24, 2002 at 18:05 UTC
    How about:
    my $somevar = <<SEP; Hello world SEP print $somevar;

    Cheers
    davis
Re: line seperator
by Rich36 (Chaplain) on Jan 24, 2002 at 18:06 UTC
    my $str = <<SEPERATOR; This is a string $xyz SEPERATOR print $str;

    Rich36
    There's more than one way to screw it up...