http://www.perlmonks.org?node_id=11130588


in reply to Parsing a line of text items

I often use Text::ParseWords for this problem. It has the advantage of being a core module.
use strict; use warnings; use feature "say"; use Text::ParseWords; my $args = '23 45.67 "John Marcus" Surname'; my @parsed = parse_line('\s+', 0, $args); say for @parsed;
Output:
23 45.67 John Marcus Surname