Reputation: 13547
What would be difference between these 2 lines of code
$bar="qwe. Aeiios qwe. Qwene. aqwet"
$bar=~/qwe/
and
$bar="qwe. Aeiios qwe. Qwene. aqwet"
$bar=~m{qwe}
What difference does the delimiter make in the code? Both of them return true
Upvotes: 1
Views: 108
Reputation: 15121
If your PATTERN includes /
then /PATTERN/
may not be able to work correctly, but m{PATTERN}
will. Otherwise, there is no difference between them.
According to perlop
:
m/PATTERN/msixpodualgc
/PATTERN/msixpodualgcIf "/" is the delimiter then the initial m is optional. With the m you can use any pair of non-whitespace (ASCII) characters as delimiters. This is particularly useful for matching path names that contain "/", to avoid LTS (leaning toothpick syndrome).
Upvotes: 4