Standard terminology for function calling in languages that have named parameters (i.e., almost all of them). If you have a function f(int $a, string $b) and you call it with f(10,"gzarp!"), then it is said that the parameter $a is bound to the argument 10, and the parameter $b is bound to the argument "gzarp!". (Or vice versa -- "gzarp!" is bound to $b, but binding is reflexive so it doesn't matter all that much. Though you could have multiple arguments bound to the same parameter in a language like Perl6.)

Regex matching is really an operator, not a function call, but the terminology is the same. Well, except you'd probably call them operands instead of parameters.

Or at least, this is the way I think about it. The terminology always made sense to me because for a long time when I started writing perl, I just used /.../ and therefore left the match string bound to the default $_. (I didn't even know there was a $_ for a while; it just all somehow magically worked out when I did a while(<>) loop.) At some point, I had a string in my own $variable that I wanted to match, and "binding" seemed as good a word as any to describe how to set the string that I was applying the match to.


In reply to Re: Why do we say the =~ operator "binds"? by sfink
in thread Why do we say the =~ operator "binds"? by Cody Pendant

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.