strfry() has asked for the wisdom of the Perl Monks concerning the following question:
file.txt is filled with 'variables' that look like [$this] - I've already found that i can call lots of perlvar ($0, $ENV{HOME}) from it, as well as such niceties as [${system'ls'}] etc. Please note that I'm disregarding the lack of use strict and -w, as I can only fight one battle at a time. ):#!/usr/bin/perl my ($template, $F_H,$file); $file = "file.txt"; if( open $F_H, $file ) { local $/ = undef; $template = <$F_H>; close($F_H); } $template =~ s/\[(\$[\w\[\]\{\}\'\"]*)\]/$1/eeg; print "Content-type: text/plain\n\n"; print $template;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Yet Another Variable Expansion Problem
by chromatic (Archbishop) on Apr 12, 2002 at 19:59 UTC | |
|
Re: Yet Another Variable Expansion Problem
by extremely (Priest) on Apr 12, 2002 at 20:12 UTC | |
|
Re: Yet Another Variable Expansion Problem
by tachyon (Chancellor) on Apr 12, 2002 at 20:55 UTC | |
|
Re: Yet Another Variable Expansion Problem
by erikharrison (Deacon) on Apr 12, 2002 at 20:55 UTC | |
|
Re: Yet Another Variable Expansion Problem
by Fletch (Bishop) on Apr 12, 2002 at 19:52 UTC | |
|
Re: Yet Another Variable Expansion Problem
by tachyon (Chancellor) on Apr 12, 2002 at 23:48 UTC |