On the page 47 of the book Learning Perl: Making Easy Things Easy and Hard Things Possible, there is
Sometimes the two delimiters can be different. If the opening delimiter is one of those “left” characters, the corresponding “right” character is the proper closing delimiter:
But, it doesn't display any case in which there are two different delimiters in pw. So, what is the meaning of the two delimiters can be different? Could you make an example and explain it?
I just don't know the meaning.
Whenever the opening delimiter is {
, [
, <
or (
, the closing delimiter is the matching closing bracket, and thus different than the opening delimiter.
Examples using paired delimiters:
qw{...}
qw[...]
qw<...>
qw(...)
This list is exhaustive without the experimental extra_paired_delimiters
feature.
For all other opening delimiters, the closing delimiter is the same as the opening delimiter.
Examples using same delimiter:
qw/.../
qw!...!
qw}...}
Tip: When using paired delimiters, you can nest them without escaping. For example, qw( foo(s) bar(s) )
is valid.