Hello
I'm reading and learning about Perl and have a basic question.
I'm not sure if Im being a bit silly...
I have searched google for a basic:simple explanation to no avail...
"Binary =~ binds a string expression to a pattern match, substitution, or transliteration (loosely called translation). These operations would otherwise search or modify the string contained in $_ (the default variable). The string you want to bind is put on the left, while the operator itself is put on the right. The return value indicates the success or failure of the operator on the right, since the binding operator doesn't really do anything on its own.
If the right argument is an expression rather than a pattern match, substitution, or transliteration, it will be interpreted as a search pattern at run time. That is to say, $_ =~ $pat is equivalent to $_ =~ /$pat/. This is less efficient than an explicit search, since the pattern must be checked and possibly recompiled every time the expression is evaluated. You can avoid this recompilation by precompiling the original pattern using the qr// (quote regex) operator."
Hey!!!!!
this link is ok, but the Penny does not drop for me ...
can someone please explain what =~ is for
thanks
I'm reading and learning about Perl and have a basic question.
I'm not sure if Im being a bit silly...
I have searched google for a basic:simple explanation to no avail...
"Binary =~ binds a string expression to a pattern match, substitution, or transliteration (loosely called translation). These operations would otherwise search or modify the string contained in $_ (the default variable). The string you want to bind is put on the left, while the operator itself is put on the right. The return value indicates the success or failure of the operator on the right, since the binding operator doesn't really do anything on its own.
If the right argument is an expression rather than a pattern match, substitution, or transliteration, it will be interpreted as a search pattern at run time. That is to say, $_ =~ $pat is equivalent to $_ =~ /$pat/. This is less efficient than an explicit search, since the pattern must be checked and possibly recompiled every time the expression is evaluated. You can avoid this recompilation by precompiling the original pattern using the qr// (quote regex) operator."
Hey!!!!!
this link is ok, but the Penny does not drop for me ...
can someone please explain what =~ is for
thanks