#!/usr/bin/perl -w my $str = "the %0A quick %2b brown %63 fox %63 jumped %24 over %7e the + %4f%45 lazy %25 dog"; print "MYWAY: ", myway(), "\nREGEXPWAY: ", regexpway(), "\n"; sub myway { $_ = $str; while (/%[0-9A-Fa-f]{2}/) { $_ = $&; /[0-9A-Fa-f]{2}/; $ob[0] = hex($&); $temp = pack("C*", @ob); $name =~ s/%[0-9A-Fa-f]{2}/$temp/; $_ = $name; } return $_; } sub regexpway { $_ = $str; s/%([a-fA-F0-9]{2})/pack("C", hex($1))/eg; return $_; } __END__ chh@scallop test> perl unescape Use of uninitialized value in substitution (s///) at unescape line 14. Use of uninitialized value in pattern match (m//) at unescape line 9. Use of uninitialized value in print at unescape line 5. MYWAY: REGEXPWAY: the quick + brown c fox c jumped $ over ~ the OE lazy % dog chh@scallop test>
In reply to RE: RE: form parsing, hex, HTML formatting
by takshaka
in thread form parsing, hex, HTML formatting
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |