in reply to <FILE> Questions

Other people have covered the problem of the substitutions. If you want to use same substutions on files and database records, I would suggest splitting the manipulations into a subroutine.
while (my $line = <FILE>) { $content .= substitute_parameters($line); } while (($content) = $sth->fetchrow_array()) { $content = substitute_parameters($content); } sub substitute_parameters { my ($content) = @_; $content =~ s/{{([a-zA-Z0-9\{\'\}_]+)}}/$hash{$1}/ge; return $content; }

Replies are listed 'Best First'.
Re: <FILE> Questions
by powerhouse (Friar) on Nov 12, 2003 at 06:20 UTC
    I do have one more question...

    Say in the database, I have one that is named say, uhm, "_domain".

    Is there a way to use a similar function to make $_domain equal to that value, IF I do not make perl do that by telling it $_domain = $vars{_domain};

    For instance, say I have in my database, like 10 different "variables" that I have named. is there a way to make those "named variables" a perl string?

    I hope I am making this clear enough. I would not know the syntax to even try it. Is it possible?

    Thank you.
    Richard