|Just another Perl shrine|
Parsing named parametersby sk (Curate)
|on Nov 07, 2005 at 02:38 UTC||Need Help??|
sk has asked for the
wisdom of the Perl Monks concerning the following question:
I have question on how to parse named parameters. I am trying to build a mini-interpreter, actually a mini code-generator based on some keywords that users put into a text file. Generating the required code is easy once i can get the parameters. Here is an example input
I would like to store these in a hash with option1 option2 and option3 as keys with their corresponding values.
I know this problem becomes much easier if the values for the options are quoted something like option1 = "value0 value1 value2". But, it would be great if i could parse the input without forcing the double quote requirement.
My attempt to split on = and then search for keywords made it so
Thanks a lot!