#!/usr/bin/perl use strict; use warnings; for my $file ( @ARGV ) { if ( ! open(INPUT, '<', $file) ) { warn "Unable to open $file - skipping!\n"; next; } while ( ) { print and next if ! /\$\w+/; $_ =~ s/\$(\w+)/$ENV{$1}/g; print; } }