# The ugly original. Still smaller than shift method. sub ed{ ($o,$d,$e)=@_; for(0..length($o)-1){ $k=$c[$_%@c]; $e.=chr(ord(substr($o,$_,1))+($d?$k:-$k)); } return $e; } # An alternative version. It is somewhat prettier I think, but it is still bigger than the original. sub ed{ @o=split"",shift; ($d,$e)=@_; for(0..$#o){ $k=$c[$_%@c]; $e.=chr(ord(shift(@o))+($d?$k:-$k)); } return $e; }