no strict 'refs'; # get a copy of the real sub our $real_param = *{"CGI::param"}{CODE}; # automagically create a new sub that contains the old sub *{"CGI::_real_param"} = \&{$real_param}; # override param() *{"CGI::param"} = sub { return Encode::decode_utf8(shift->_real_param(@_)); };