in reply to Re: char. VS char.
in thread char. VS char.

I agree, hashes seem to be more appropriate for this kind of thing, I've whipped up a generic sub here that seems to be a little more in tone with what the original poster requested:

#!/usr/bin/perl -w use strict; #always sub myencode { my ($sentence,$encodehash)=@_ or die "not enough parameters for enco +de:@_"; foreach my $key (keys %$encodehash) { $sentence =~ s!$key!$$encodehash{$key}!g; } return $sentence; } my %encoding=("A"=>"D","B"=>"E","C"=>"F"); print myencode("ABC",\%encoding);

qw[marcus]