in reply to Seeking best approach to column parsing
You don't even have to use the regex inside of a split:
use strict; while (<DATA>) { my @elements = split; print ">", join(':', @elements), "<\n"; } 1; __DATA__ 1 1234 gg123456789 000-12345-1234-111 12 1234 gg123456789 000-12345-1234-111 123 1234 gg123456789 000-12345-1234-111
split's behavior with no args will do what you want, with the bonus of ignoring leading/trailing whitespace. See perlfunc.
|
|---|