in reply to Counting words..

The substitution decodes URL-encoded strings. It does the same uri_unescape in URI::Escape. CGI already decodes parameters for you. Is there any reason you're not using that module?

my $count = () = /$keyword/gi; will count the number of occurances. The () forces a list context.