pattern matching - What does s-/-- and s-/\Z-- in perl mean? -


i beginner in perl , have query regarding pattern matching. came across line in perl written

  $variable =~ s-/\z--; 

and code goes ahead variable assigned

  $variable1 =~ s-/--; 

can please tell me these 2 lines do? want know s-/\z-- , s-/-- mean.

$variable =~ s-/\z--; 

- used delimiter here. however, best practice suggests either use / or {} delimiters.

it re-written as:

$variable =~ s{/\z}{};  # remove / @ end of string 

consider:

$variable1 =~ s-/--; 

again, re-written as:

$variable1 =~ s{/}{};  # remove first / 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -