in reply to A minor epiphany

If you have several things to do, you can localize $_ (Re: Re: $_ haters anonymou notwithstanding):
# I suppose I must be in the $_ appreciation society :) for ($guarantee) { s/this/that/g; s/foo/bar/g; #..etc. } # or (probably not preferable in this case, but it IS sometimes # handy to localize $_, e.g. in File::Find 'wanted()' subroutines) { local $_ = $guarantee; # ... some operations on $_ $_ = $guarantee; }

Replies are listed 'Best First'.
(tye)Re: A minor epiphany
by tye (Sage) on Feb 03, 2001 at 21:54 UTC

    Just a slight expansion... The first one translates roughly to:

    { local $_; *_= \$guarantee; s/this/that/g; s/foo/bar/g; }

    which means that during that block you can take and keep a reference to \$_ and you'll get a reference to $guarantee (not that such happens often, but it is one way to distinguish between the two). (:

            - tye (but my friends call me "Tye")