in reply to Parsing, tokens and strings
use Text::ParseWords qw( shellwords ); $line = q{Token1 Token2 "Little phrase" Token4}; @array = shellwords( $line ); print join( "\n", @array ), "\n";
And that has the advantage of Text::ParseWords being core. If you don't mind fetching from CPAN, c.f. Text::Balanced and Regexp::Common.
Update: Of course I just now noticed that merlyn had mentioned Text::ParseWords above. /me should read the whole thread more carefully.
|
|---|