my $string = "Hello"; if ($enc) { print '{blowfish}', encrypt_string ($string); } else { print "{unencrypted}$string"; } .... my $val = $q->param ('foo'); my $actual_val; if ($val =~ /^{([a-z]+)}(.*)$/) { if ($1 eq 'blowfish') { $actual_val = decrypt ($2); } else { $actual_val = $2; } else { $actual_val = $val; # didn't match - old-style param? }