For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > August 2007 > printing long strings









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author printing long strings
R Chandrasekhar

2007-08-30, 7:26 pm

Dear Folks,

I need to print diagnostic message strings like:

warn "$parent/$child does not exist: verification failed\n";

in conditional blocks that are nested and indented. This means that, on
occasion, the message string overflows to the next line in an 80-character line
in my source file. The message, when it appears, is also broken at the same
point. I would like the message to appear on one line without being artificially
broken because of indentation.

I have tried looking for a perl continuation character or other likely solution
and not found it. I am sure that this is a commonly encountered situation. What
is the simple solution for this?

Thanks.

Chandra
30 Aug 07
Gunnar Hjalmarsson

2007-08-30, 10:20 pm

R (Chandra) Chandrasekhar wrote:
> I need to print diagnostic message strings like:
>
> warn "$parent/$child does not exist: verification failed\n";
>
> in conditional blocks that are nested and indented. This means that, on
> occasion, the message string overflows to the next line in an
> 80-character line in my source file. The message, when it appears, is
> also broken at the same point. I would like the message to appear on one
> line without being artificially broken because of indentation.


Either print a list of strings:

warn "$parent/$child does not exist: ",
"verification failed\n";

or concatenate the message parts:

warn "$parent/$child does not exist: "
. "verification failed\n";

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com