You could do create the string then strip the space.  I think there was
something in the Perl Cookbook that was similar to this.

my $longlist = no_space(<<END_OF_LIST);
        Clause1|
        Clause2|
        Clause3|
        Clause4
END_OF_LIST

print $longlist;


sub no_space
{
  my $txt = shift;
  $txt =~ s/^\s+//;
  $txt =~ s/\s*\n\s*//sg;
  $txt =~ s/\s+$//;
  return $txt;
}

Rob

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 01, 2004 3:16 PM
To: [EMAIL PROTECTED]
Subject: Loading Scalar Vars with Text - Readability


Hi, 
   Adding Perl to the list of languages... and came across a question of
loading vars with very long strings...

   Actually I am modifiying a prior employee's code and want to make it
more readable.

currently the code is such:
my $longlist = "Clause1|Clause2|Clause3|Clause4|...|ClauseN";

I would like to know why I can't make this more readable?  Is it because
newline characters would be added to the mix?  I would like to do
something like this:

my $longlist = "Clause1|
                Clause2|
                Clause3|
                Clause4|
                ...|
                ClauseN";

Please copy me directly on your response.  T

Thanks,
Art Bahrs
[EMAIL PROTECTED]



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to