That regex doesn't match what you think it does. The . is special. Tip #6 from the Basic debugging checklist: YAPE::Regex::Explain:
---------------------------------------------------------------------- ^ the beginning of the string ---------------------------------------------------------------------- 0 '0' ---------------------------------------------------------------------- . any character except \n ---------------------------------------------------------------------- 00000 '00000' ----------------------------------------------------------------------
You could use map to format certain elements of your array:
Show some input and desired output.use warnings; use strict; my @cols = qw(3.456 8.903 1.223); @cols = map { sprintf '%8.1f', $_ } @cols; print "@cols\n"; __END__ 3.5 8.9 1.2
In reply to Re: column counter and printf question
by toolic
in thread column counter and printf question
by fasoli
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |