in reply to printing enviroment vars from regex
#!/usr/bin/perl use strict; use warnings; for my $file ( @ARGV ) { if ( ! open(INPUT, '<', $file) ) { warn "Unable to open $file - skipping!\n"; next; } while ( <INPUT> ) { print and next if ! /\$\w+/; $_ =~ s/\$(\w+)/$ENV{$1}/g; print; } }
Cheers - L~R
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: printing enviroment vars from regex
by BUU (Prior) on Aug 01, 2004 at 19:43 UTC | |
by Limbic~Region (Chancellor) on Aug 01, 2004 at 19:46 UTC | |
by Aristotle (Chancellor) on Aug 01, 2004 at 19:54 UTC | |
by Limbic~Region (Chancellor) on Aug 01, 2004 at 20:02 UTC | |
by Aristotle (Chancellor) on Aug 01, 2004 at 20:15 UTC |