use strict; use warnings; my %expects = ( PROMPT => 5, FOO => 6 ); for my $evar (keys %expects) { if (exists $ENV{$evar}) { warn "No match for $evar\n" unless ($ENV{$evar} =~ /\Q$expects +{$evar}\E/); } else { warn "No $evar in ENV\n"; } }
On a side note, please update your post to add code tags around your code. Read Writeup Formatting Tips.
In reply to Re: Environment variable
by toolic
in thread Environment variable
by rohit2007
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |