Sometimes it just looks better to me to do this:

                print "This is my first line.\n";
                print "And this is my second.\n";
                print "And this is my third.\n";

It may not be the quickest or the shortest, but it's easy to read.

-----Original Message-----
From: drieux [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 24, 2002 1:44 PM
To: [EMAIL PROTECTED]
Subject: Re: Setting a Variable to String with \n?



On Wednesday, April 24, 2002, at 01:18 , Michael Norris wrote:
[..]
> But what if I'm doing an elsif and my code is indented such as:
>     elsif ($string == 1) {
>         $string = This is the text I want
>                   But I also want this text on next line.
>
> Is there a way to ignore the white space before the "But I also want this 
> text on the next line?"  Otherwise I would have to do the following:

cf perodoc perlfaq4 - on or about page 17 or so....

in the perldoc perldata you will find:


            ($quote = <<'FINIS') =~ s/^\s+//gm;
                The Road goes ever on and on,
                down from the door where it began.
            FINIS

but be forewarned that 'FINIS' has to start in Column Zero; eg:

sub SetTheQuote {
        my ( $quote); # = @_;

     ($quote = <<'FINIS') =~ s/^\s+//gm;
                The Road goes ever on and on,
                down from the door where it began.
FINIS
      $quote ;

} # end of SetTheQuote

unless you clean up your '      FINIS'
        FINIS

in short - tab inside the ' ' or better yet - have the
spaces stuffed there....

# unlike in /bin/sh where one could
        VAR<<-HEREIS
                stuff
                stuf
        HEREIS

tabbed over and all

from the man sh

        "If the operator is ``<<-'' instead of
        ``<<'', then leading tabs in the here-doc-text are
        stripped."


ciao
drieux

---


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to