#!/usr/bin/perl -w use strict; use warnings; sub show { for my $var (@_) { print "$var: ".(defined $ENV{$var} ? $ENV{$var} : '')."\n"; } } show(qw(dir work_dir prog_path prog_dir prog conf conf_file_var PATH PERL5LIB)); show(qw(hello world)); print "$_\n" for @ARGV;