in reply to Parsing a line of text items
A Text::CSV solution:
use strict; use warnings; use Text::CSV; use Test::More tests => 2; my $in = '23 45.67 "John Marcus" Surname'; my $want = [23, 45.67, 'John Marcus', 'Surname']; my $csv = Text::CSV->new ({sep_char => ' '}); ok $csv->parse ($in), 'Parsing'; is_deeply [$csv->fields], $want, 'Fields match';
You will probably want to extend the tests to better reflect your real-world requirements.
🦛
|
|---|