[Israel.pm] A question of style - print()

Mikhael Goikhman migo at homemail.com
Mon Oct 31 07:32:10 PST 2005

On 31 Oct 2005 16:15:08 +0200, David Baird wrote:
> I sometimes handle this problem with the following Perl code:
>     $message = qq{

I suppose the leading "(" is missing here.

>         |A new service request was sent to an IT representative.
>         |
>         |Assigned to: $assign_first $assign_last
>         |Due date: } . $duedate->string(1) . qq{
>         |Description:
>         |$param{-desc}
>         |
>         |You can check on the status of your requests from the IT Help Desk
>         |web page.
>     }) =~ s/^\s+[|]//gm;
>     print $message;

I do similar thing except that I remove leading tabs in each line (I use
tabs for indentation), so special delimiters like "|" are not needed.
You should also remove spacing of the last line, it may be invisible for
email, but may matter in other places. So, in my case this looks like:

	(my $message = qq{
		The new version $package-$version is out.
		For more info, visit the $package home page:


		User visible changes are described in file NEWS.
	}) =~ s/^\t+//gm;
	print $message;

In rare cases the message itself includes tabs, I use s/^\t{1,2}//gm.
The style of "|" separators is interesting, although not as transparent.


perl -e 'print+chr(64+hex)for+split//,d9b815c07f9b8d1e'

More information about the Perl mailing list