Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

Perl Programming/Keywords/quotemeta

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

Perl qr qw Keywords The quotemeta keyword The quotemeta command returns the value of EXPRESSION such that all the ASCII non-"word" characters (that do not match with [A-Za-z_0-9]) are backslashed. This is the internal function implementing the \Q escape in double-quoted strings. If EXPRESSION is not passed, the function uses $_ instead. Syntax quotemeta EXPRESSION Examples The code my $sentence = 'The quick brown fox jumpes over and over again.'; my $substring = 'quick.*?fox'; my $quoted_substring = quotemeta($substring); $sentence =~ s{$quoted_substring}{big bad wolf}; print '"', $sentence, "\"\n\"", $substring, "\"\n\"", $quoted_substring, "\"\n"; returns the following: "The quick brown fox jumpes over and over again." "quick.*?fox" "quick\.\*\?fox" Perl qr qw Keywords