I would go for readability instead.
my $fixed = $ptext; $fixed =~ s/^['"]//; $fixed =~ s/['"]\z//; $fixed = quotemeta($fixed);
That's probably useless since your list of meta characters differs from quotemeta's. If so, then you can use:
my $fixed = $ptext; $fixed =~ s/^['"]//; $fixed =~ s/['"]\z//; $fixed =~ s/([\\'"...])/\\$1/g;
In reply to Re^3: Regexp and metacharacters
by ikegami
in thread Regexp and metacharacters
by Largins
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |