in reply to Re: Parsing a line of text items (updated)
in thread Parsing a line of text items
But I think the suggested Text::ParseWords is core and offers everything I expect from parsing a command line.
It has also tests, is cutomizable and the source is well structured and documented.
So if I "wanna roll my own" and need to make special adjustments (like e.g. paired {quotes} ) I can take the code as a base.
DB<94> use Text::ParseWords qw/shellwords/ DB<96> x shellwords(q{this is 'an example' "with different quoting a +nd \" escaping" including\ escaped\ whitespace}) 0 'this' 1 'is' 2 'an example' 3 'with different quoting and " escaping' 4 'including escaped whitespace' DB<97>
In case larger files need to be parsed I'll consider a dependency to Text::CSV , but this really looks good.
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Parsing a line of text items
by AnomalousMonk (Archbishop) on Apr 01, 2021 at 07:01 UTC | |
by LanX (Saint) on Apr 01, 2021 at 10:08 UTC |