in reply to Unpack/format
$pad = ' ' x 80; ## make the length the same as your max expected $c = "test test test"; $fmt = "A4 x1 A4 x1 A4 x1 A4"; @c = unpack($fmt, "$c$pad"); print join ("*",@c), "\n"; $d = "test test test "; $fmt = "A4 x1 A4 x1 A4 x1 A4"; @d = unpack($fmt, "$d$pad"); print join ("*",@d), "\n";
--Jim
Update: BTW, I would avoid using $a as a variable since it (and $b) has an evil association with sort. Check the link for details.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Unpack/format
by Reverend Phil (Pilgrim) on Feb 13, 2002 at 17:17 UTC |