in reply to Re: Setting values for undefined environment variables
in thread Setting values for undefined environment variables

Thanks, but one problem with this approach is that I am actually using a heredoc to print. I didn't say this in my OP. I better add an update.
  • Comment on Re^2: Setting values for undefined environment variables

Replies are listed 'Best First'.
Re^3: Setting values for undefined environment variables
by Fletch (Bishop) on Oct 24, 2004 at 03:07 UTC

    And that's a problem why?

    ... print <<"EOT"; The environment variable $foo is: @{[ ENV( $foo ) ]} That is all. EOT ...
      Fletch,
      If we are going to get silly, why not get ridiculous?
      #!/usr/bin/perl use strict; use warnings; package magic; sub ENV { defined $ENV{$_[0]} ? $ENV{$_[0]} : 'undefined' }; sub TIEHASH {bless {}, $_[0]} sub STORE {} sub FETCH {ENV($_[1])} package main; tie my %magic , 'magic'; print <<"--"; $magic{PATH} $magic{FOOBAR} --

      Cheers - L~R