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

Re: escape character in regex

Thread Previous | Thread Next
From:
Henrik Park
Date:
October 11, 2022 01:50
Subject:
Re: escape character in regex
Message ID:
6f408515-938e-ca25-8619-9b6ec3b86889@simplemail.co.in
John,

for my this code:

my $delimiter = '$';
my $str = 'hello$world$buddy';
my @li = split/$delimiter/,$str;
print "@li","\n";

How can I make it work correctly?

Thanks

John W. Krahn wrote:
> "/" is NOT a special charater in a regular expression.  It is just that 
> in Perl the default delimiter for some operators is "/" (i.e. m//, s///, 
> tr///, etc.).

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

Thread Previous | 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