Different Delimiters

While we normally think of patterns as being delimited with / characters, they can be delimited by almost any character. perlre describes this. For example, the s/// above uses braces as delimiters. Selecting another delimiter can avoid quoting the delimiter within the pattern:

    s/\/usr\/local/\/usr\/share/g;	# bad delimiter choice
    s#/usr/local#/usr/share#g;		# better


Back to perlfaq6