|The stupid question is the question not asked|
Re: Why do we say the =~ operator "binds"?by krusty (Hermit)
|on Apr 18, 2004 at 03:46 UTC||Need Help??|
One reason is to verbally differentiate it from the assignment operator. Syntactically, there is already a notable difference. A common perl mistake is to state the following:
$var = /$pattern/;
which actually checks the pattern against the global special default variable $_ and sets $var to either "" or 1 (result of evaluating match). Probably not what the hapless programmer meant to say. I suppose one could read it as:
matches against $var =~ /$pattern/,
substitutes against $var =~ s/$pattern/$replacement/,
or even transliterates against (yikes, that's a mouthful) $var =~ tr/a-z/A-Z/.
but the word bind will work nicely for all three.
Another reason may be just because Larry Wall felt like it at the time. ;-)