Is there an equivalent of JavaScripts escape() function in Perl?

Submitted by: Administrator
Try This:

require CGI;
$escaped = CGI::escape( $normal );

# ...or...

sub escape {
my $str = shift || '';
$str =~ s/([^w.-])/sprintf("%%%02X",ord($1))/eg;
$str;
}
$escaped = escape( $normal );
Submitted by: Administrator

Read Online CGI Programming Job Interview Questions And Answers