in reply to Print array from here-doc
use strict; use warnings; my @SKUs = ( [ q{Bumble}, q{Broth}, 16 ], [ q{Wedgie}, q{Benns}, 22 ], [ q{Party}, q{Games}, 6 ], ); local $"; my $msg = <<END_OF_BODY; The number of SKUs that have been flagged as DeleteMe Here is the list of SKUs and their counts: PLANNERCODE\tDEALER\tCOUNT ----------------------------- @{ [ map { sprintf qq{%11s\t%6s\t%5d\n}, @$_ } @SKUs ] } END_OF_BODY print $msg;
Here's the (slightly flawed) output. If any Monk can see what is causing the misalignment I'd be very interested in finding out.
The number of SKUs that have been flagged as DeleteMe Here is the list of SKUs and their counts: PLANNERCODE DEALER COUNT ----------------------------- Bumble Broth 16 Wedgie Benns 22 Party Games 6
I hope I have guessed right and this of use to you.
Cheers,
JohnGG
Update: shigetsu spotted my error, thanks. local $"; line inserted above here-doc to suppress the normal list separator of a space that was throwing things off.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Print array from here-doc
by shigetsu (Hermit) on Apr 25, 2007 at 22:48 UTC | |
by johngg (Canon) on Apr 25, 2007 at 22:54 UTC | |
by sasrs99 (Acolyte) on Apr 25, 2007 at 23:00 UTC |