SPUG: line breaks in format fields
Ben McEldowney
some_joe_named_jim at yahoo.com
Thu Nov 16 15:18:04 PST 2006
I'm a bit new to Perl and this may not be the solution you're looking for, but would it be possible to include the "\n" in your original $bigTextField declaration?
Ryan Allen <ryan at the-summit.net> wrote:
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 |
+-----------------------------+
_____________________________________________________________
Seattle Perl Users Group Mailing List
POST TO: spug-list at pm.org
SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list
MEETINGS: 3rd Tuesdays
WEB PAGE: http://seattleperl.org/
---------------------------------
Sponsored Link
Mortgage rates near 39yr lows. $310,000 Mortgage for $999/mo - Calculate new house payment
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/spug-list/attachments/20061116/b771a72b/attachment.html
More information about the spug-list
mailing list