Globals are an important exception here. If you log($!), you may easily have a clobbered $! by the time you use it. log("$!") gets a snapshot of the variable at the time of the call.

In reply to Re^3: Perl cheat sheet by ursus
in thread Perl cheat sheet by Juerd

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