Perl quotemeta Function



Description

This function escapes all meta-characters in EXPR. For example, quotemeta("AB*..C") returns "'AB\*\.\.C".

Syntax

Following is the simple syntax for this function −

quotemeta EXPR

Return Value

This function returns a string with all meta-characters escaped.

Example

Following is the example code showing its basic usage −

#!/usr/bin/perl -w

print quotemeta("AB*\n[.]*");

When above code is executed, it produces the following result −

AB\*\
\[\.\]\*
perl_function_references.htm
Advertisements