in reply to How do you replace variables in an external string?

Two quick ideas, are you using single quotes to assign that variable, such as?
my $line = 'Hello $cgi->param("name"), how are you today?';
If not, I believe you can't use method calls inside a string, and expect it to interpolate, use an temp variable, such as:
my $name = $cgi->param('name');
and then:
my $line = "Hello $name, how are you today?";
If making an temp variable for each param, then a nice hash will do: (Untested)
my %cgiform; for my $key ($cgi->param) { $cgiform{$key} = $cgi->param($key); }
And then you can just use $cgiform{name}.

Update: If you have more than one value with each form input, follow Kanji's suggestion bellow.

Replies are listed 'Best First'.
Re: Re: How do you replace variables in an external string?
by Kanji (Parson) on Apr 04, 2002 at 19:20 UTC
    And then you can just use $cgiform{name}.

    Unfortunately, this method only works if you're expecting there to be only one value associated with name.

    However, if you use CGI's import_names('FORM') method, you can get the first value using $FOO::name or get all the values with @FOO::name.

        --k.