in reply to column counter and printf question
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: column counter and printf question
by fasoli (Beadle) on Oct 28, 2015 at 12:38 UTC | |
by Laurent_R (Canon) on Oct 28, 2015 at 14:35 UTC |