KW.pm Only the Lonely #9

use Env;

  • By default, ties global scalars for all variables in shell environment

  • Can tie to global arrays too:

  • via an import list, specifying arrays and scalars:

          use Env qw[@PATH $USER];          # only tie these variables
          push @PATH, '.';                  # live update to $PATH
          print "$USER's path is:\n ", join '\n', @PATH;   
  • Downside: modifying array variable requires it to re-split the string.

<< Previous | Index | Next >> Copyright © 2005 Daniel Allen