in reply to quotewords and qq{}/q{}

Is your user input coming at you as a perl expression to be evaled, or does q{} or qq{} get evaluated in the user's process before you see it?

In the second case, there is no difference between qq{} and "" or q{} and ''.

In the first, you're trusting your users more than you ought to.

After Compline,
Zaxo

Replies are listed 'Best First'.
Re: quotewords and qq{}/q{}
by jonadab (Parson) on Jan 27, 2007 at 17:23 UTC
    Is your user input coming at you as a perl expression to be evaled, or does q{} or qq{} get evaluated in the user's process before you see it?

    The way I read his post, neither. It looks to me like users are supplying data that he wants to parse, but they want to supply it with Perl-style quoting constructs, probably for the obvious reason that Perl-style quoting constructs eliminate most of the worst problems with escaping quote characters in short bits of quoted text.

    OTOH, if we knew more about long_story, it is possible that there is another, possibly even a better, solution.

    -- 
    We're working on a six-year set of freely redistributable Vacation Bible School materials.
      Thanks for all the feedback. You are all correct. My users are inputting a string to be split like a shell. Yet, there is a complication since the user's input would also like CPP pre-processing which will not modify things within quotes. For this reason, I would like to provide the users a method for quoting without quotes (e.g. qq{} or q{}). These operators would allow CPP to perform substitutions which is great. Yet, afterwards, I would continue to want to "parse" the input string like a shell using something like "quotewords".