LoginSignup
3
3

More than 5 years have passed since last update.

Perl でメタ文字をエスケープする方法いろいろ

Last updated at Posted at 2013-04-15
# メタ文字をエスケープしないまま正規表現にかけると地味にハマるので。。。

# メタ文字をエスケープする : 
my $path = qq(C:\\hogehoge\\hoge.dll);

#  (1) エスケープシーケンス \Q ... \E 使用
print qq(\Q$path\E);
# > C\:\\hogehoge\\hoge\.dll

#  (2) 関数 quotemeta 使用
print quotemeta $path;
# > C\:\\hogehoge\\hoge\.dll
3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3