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

Re: escape character in regex

Thread Previous | Thread Next
Henrik Park
October 11, 2022 01:50
Re: escape character in regex
Message ID:

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?


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

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About