Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re(4) Whether to use local()

by dmmiller2k (Chaplain)
on Mar 16, 2002 at 04:25 UTC ( [id://152151] : note . print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    use vars qw( $x );      # a package global
    
    ...
    # to 'inner' and in both cases, the value of $x is restored when the
    # block exits, except in the 'local' case, it is not necessary to
    # explicitly restore $x
    
  2. or download this
    # need to 'slurp' in an entire file
    {
    ...
      # (read the file, etc.)
    }
    # $/ is now restored to whatever it was before