in reply to qr/string/ is not the same as qr/$var/ ?

\L, \U, \Q, \l and \u are dealt with during parsing of a quoted construct, which takes up to five passes:
  1. Find the end of the quoted construct.
  2. Removal of backslashes before delimiters.
  3. Interpolation (this is where \L and friends processing happens)
  4. Interpolation of regular expressions.
  5. Optimization of regular expressions.
For details, see the section Gory details of parsing quoted constructs in the perlop manual page.

So, by the time the regex engine gets the string, any \L it finds it treats is as an escaped L - which will trigger a warning.

Strings gotten from the environment, like program parameters, are never parsed as quoted constructs (unless you 'eval' them).

  • Comment on Re: qr/string/ is not the same as qr/$var/ ?