1.

Is There An Equivalent Of Javascripts Escape() Function In Perl?

Answer»

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 );

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 );



Discussion

No Comment Found