develooper Front page | perl.beginners | Postings from October 2022

escape character in regex

Thread Next
From:
Henrik Park
Date:
October 11, 2022 01:12
Subject:
escape character in regex
Message ID:
ef5c78fc-c521-40df-f32d-5d1259a7dd47@simplemail.co.in
Hello

I know "/" is a special character for regex, which should be escaped.

But if I put "/" in a variable and use the variable in regex, then it 
doesn't need the explicit escape. Like this one:

$ perl -le '$delimiter="/"; $str="hello/world/buddy"; 
@list=split/$delimiter/,$str;print "@list"'
hello world buddy


Am I right? thank you.


-- 
Simple Mail
https://simplemail.co.in/

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About