in reply to Environment variable

Create a hash of your expected variable names and value regexes. Then loop through your hash looking for matches:
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.