On Tue, 29 Oct 2002 19:32:16 +0200, Detlef Lindenthal wrote:
> m'(.{2})(.{7})(.{9})(.{10})([^ ]*)([^,]*),?(?:([^,]*),?)?(.*)'g;
> printf "%-3s %-8s %-11s %-11s %-11s %-12s %-12s %-12s %-12s \n", $1, $2,
>$3, $4, $5, $6, $7, $8;
> printf D_O "%-3s %-8s %-11s %-11s %-11s %-12s %-12s %-12s %-12s \n", $1, $2,
>$3, $4, $5, $6, $7, $8;
A few tips:
* If you plan on using all captured values, why not capture them in an
array?
my @m = m'(.{2})(.{7})(.{9})(.{10})([^ ]*)([^,]*),?(?:([^,]*),?)?(.*)'g;
* two: you appear to want to print the same string twice. Then build the
string as a first step!
$_ = sprintf "%-3s %-8s %-11s %-11s %-11s %-12s %-12s %-12s %-12s \n",
@m;
print;
print D_O;
* Finally, you attempt to do something known as "tee" in the Unix
world. Perhaps some module might help you achieve that effect. I thought
there was an entry on "tee" in the FAQ, but now I can't find it. There's
an IO::Tee module available on CPAN.
(All untested, though.)
--
Bart.