SPUG: line breaks in format fields

Ryan Allen ryan at the-summit.net
Thu Nov 16 14:45:20 PST 2006


Does anybody know how to get "\n" in a format field to be preserved in
the output?  For example, suppose I have this code:

#!/usr/bin/perl

my $bigTextField = " 
I am a dynamic figure, often seen scaling walls and crushing ice. I have been known to remodel train stations on my lunch breaks, making them more efficient in the area of heat retention. I translate ethnic slurs for Cuban refugees, I write award-winning operas, I manage time efficiently.  Occasionally, I tread water for three days in a row.  

I woo women with my sensuous and godlike trombone playing, I can pilot bicycles up severe inclines with unflagging speed, and I cook Thirty-Minute Brownies in twenty minutes. I am an expert in stucco, a veteran in love, and an outlaw in Peru.  

Using only a hoe and a large glass of water, I once single-handedly defended a small village in the Amazon Basin from a horde of ferocious army ants.  I play bluegrass cello, I was scouted by the Mets, I am the subject of numerous documentaries. When I'm bored, I build large suspension bridges in my yard. I enjoy urban hang gliding. On Wednesdays, after school, I repair electrical appliances free of charge. 
";

format STDOUT =
+--------------------------------------------------------------------+
|  ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ~~   |
   $bigTextField
+--------------------------------------------------------------------+
.

write;


What I end up with is:
+--------------------------------------------------------------------+
|   I am a dynamic figure, often seen scaling walls and              |
|  crushing ice. I have  been known to remodel train stations        |
|  on my lunch breaks, making them more  efficient in the area       |
|  of heat retention. I translate ethnic slurs for Cuban             |
|  refugees, I write award-winning operas, I manage time             |
|  efficiently.  Occasionally, I tread water for three days in       |
|  a row.   I woo women with my sensuous and godlike trombone        |
|  playing, I can pilot  bicycles up severe inclines with            |
|  unflagging speed, and I cook Thirty-Minute  Brownies in           |
|  twenty minutes. I am an expert in stucco, a veteran in love,      |
|  and  an outlaw in Peru.   Using only a hoe and a large glass      |
|  of water, I once single-handedly defended a small village in      |
|  the Amazon Basin from a horde of ferocious army ants. I           |
|  play bluegrass cello, I was scouted by the Mets, I am the         |
|  subject of  numerous documentaries. When I'm bored, I build       |
|  large suspension bridges in  my yard. I enjoy urban hang          |
|  gliding. On Wednesdays, after school, I repair  electrical        |
|  appliances free of charge.                                        |
+--------------------------------------------------------------------+

But what I want is:
+--------------------------------------------------------------------+
|   I am a dynamic figure, often seen scaling walls and              |
|  crushing ice. I have  been known to remodel train stations        |
|  on my lunch breaks, making them more  efficient in the area       |
|  of heat retention. I translate ethnic slurs for Cuban             |
|  refugees, I write award-winning operas, I manage time             |
|  efficiently.  Occasionally, I tread water for three days in       |
|  a row.                                                            |
|                                                                    |
|  I woo women with my sensuous and godlike trombone                 |
|  playing, I can pilot  bicycles up severe inclines with            |
|  unflagging speed, and I cook Thirty-Minute  Brownies in           |
|  twenty minutes. I am an expert in stucco, a veteran in love,      |
|  and  an outlaw in Peru.                                           |
|                                                                    |
|  Using only a hoe and a large glass                                |
|  of water, I once single-handedly defended a small village in      |
|  the Amazon Basin from a horde of ferocious army ants. I           |
|  play bluegrass cello, I was scouted by the Mets, I am the         |
|  subject of  numerous documentaries. When I'm bored, I build       |
|  large suspension bridges in  my yard. I enjoy urban hang          |
|  gliding. On Wednesdays, after school, I repair  electrical        |
|  appliances free of charge.                                        |
+--------------------------------------------------------------------+

Is there a "trick"?

Thanks!
-Ryan



-- 

+-----------------------------+
|     ryan at the-summit.net     |
|  http://www.the-summit.net  |
+-----------------------------+


More information about the spug-list mailing list