in reply to Re^2: Switching out text only in a variable
in thread Switching out text only in a variable

Use CGI's html generation methods.

# Assuming $q is from CGI->new my $url = $q->My::CGI::hypothetical_param( search => 'value' )->self_u +rl; sub My::CGI::hypothetical_param { my $current_q = shift; my $q = CGI->new( $current_q ); my $params = { @_ }; while ( my ( $param, $value ) = each %$params ) { if ( not defined $value ) { $q->delete ( $param ); } else { $q->param( $value ); } } $q; }