Nyimi Jose wrote: > I have a string (ascii). > I would like to apply a rule on it before saving it to a file -> coding > ... And apply the same rule to get the original string while reading from > the file -> decoding ... > > Any Idea ?
there are ency/decy modules in CPAN that you should check out. for a brain-dead appoach try: #!/usr/bin/perl -w use strict; my $i = "abcd"; my $j = mess_it($i); print "$j\n"; print fix_it($j),"\n"; sub fix_it{ my $s = shift; $s =~ s#(.)#chr(ord($1)/2)#ge; return $s; } sub mess_it{ my $s = shift; $s =~ s/(.)/chr(ord($1)*2)/ge; return $s; } __END__ anyone who knows a little Perl can easily figure out a way to decode the mess-ed string. it's not secure at all. but if you just want to prevent users from looking at your data, that might help. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]