to escape the occurrences of exclamation symbols (!) that will be supplied by the user so that they are not interpreted as part of the HTML and Perl code.
First of all, I'm not sure why do you need to escape exclamation symbols. Are you going to feed user input to an HTML browser, to the Perl interpeter, or both? On the one hand, !
does not have a special meaning in HTML, so when you feed text with !
s to a browser, you can leave them unchanged (but run the input through a proper HTML escaping function from a well-tested CPAN module). On the other hand, to make !
have no special meaning (negation operator) in Perl (ETA
: special meaning in Perl source code, not inside Perl strings), you'll have to quote it (!
, but now you have to do something with a string) or to comment it out (!
→ # !
, Perl will completely ignore the comment). \!
won't help: it's "return the reference
to the result of negation", not "verbatim exclamation mark". And feeding untrusted user input to Perl is not a good thing to do anyway. Good thing that you can safely work with arbitrary strings without escaping them in Perl unless you eval
them (or feed to shell
, see also: perlsec
) What exactly do you really need
to do with $query->param('team_name')