in reply to problem with splitting file on whitespace: how to circumvent inconsistent formatting through file
Just a guess, are the columns fixed width? If so, unpack can help.
while (<DATA>) { chomp; my @fields = unpack('a7 a7 a7'); print join(" ", map {"\"$_\""} @fields), "\n"; } __DATA__ 15,567-25,324-45,234 -13,345 53,562 13,452 -7,521-22,454-54,671
Outputs:
" 15,567" "-25,324" "-45,234" "-13,345" " 53,562" " 13,452" " -7,521" "-22,454" "-54,671"
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: problem with splitting file on whitespace: how to circumvent inconsistent formatting through file
by angela2 (Sexton) on Jul 04, 2016 at 12:41 UTC | |
by Anonymous Monk on Jul 04, 2016 at 12:54 UTC | |
by angela2 (Sexton) on Jul 04, 2016 at 14:01 UTC |