$ for num in $( seq 1 3 ); do perl print_env_num.pl; done $ for num in $( seq 1 3 ); do export num; perl print_env_num.pl; done 1 2 3 $ cat print_env_num.pl #!/usr/bin/perl -l # vim: set ts=4 sw=4 et sta: use strict; use warnings; print $ENV{num} if exists $ENV{num};