I have the following hash:
And two functions,:my %key = ( '1'=>'?', '2'=>'/', '3'=>'>', '4'=>'<', '5'=>':', '6'=>';', '7'=>'[', '8'=>']', '9'=>'{', '0'=>'}', '!'=>'p', '@'=>'o', '#'=>'i', '$'=>'d', '%'=>'j', '^'=>'h', '&'=>'g', '*'=>'k', '('=>'5', ')'=>'3', '-'=>'2', '+'=>'9', '='=>'%', '\\'=>'c', '|'=>'1', '~'=>'^' );
andsub decode { my $char; my $meta; foreach $char (keys %key){ $meta =quotemeta $key{$char}; $$message->{body} =~ s/$meta/$char/gis; } }
But when it comes time to encode or decode a message like: this: ^5*9|1(1#|my $char; my $meta; foreach $char (keys %key){ $meta =quotemeta $char; $$message->{body} =~ s/$meta/$key{$char}/gis; }
becomes this: h:k{1?:?i1
ok, not problem, but going th reverse, this: h:k{1?:?i1
becomes this: \~5*9||5|#|
That's a problem ... can you help me understand why it's not doing the correct subs.
thanks, me
In reply to problematice metashar regexp by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |