[prev] [index] [next]

Variables (cont)

Many scalar operations have the notion of a "default source/target".

If you don't specify an argument, they assume one called $_.

This makes it

  • often very convenient to write brief programs   (minimal syntax)
  • sometimes confusing to new users   ("Where's the argument??")
$_ performs a similar role to "it" in English text.

E.g. "The dog ran away. It ate a bone. It had lots of fun."