On Wed, Aug 22, 2001 at 04:10:05PM -0500, SAWMaster wrote:
> print "Select a letter to change to: ";
> $lettertochangeto = <STDIN>;
> if ($lettertochangeto =~ m/$workingcopy/i)#####PROBLEM LINE I THINK
For one, you aren't doing any verification to make sure $lettertochangeto is
indeed only one letter. You also fail to chomp it, thus guaranteeing it
isn't a letter at all.
Also, your match is verifying that $lettertochangeto contains the pattern
$workingcopy. This test should be reversed, or better yet, replaced with
a call to index; you don't need a regex for this.
> {
> print "That letter is already being used, try again.";
> &manual;
> }
> else
> {
> eval "\$workingcopy =~ tr/$lettertochange/$lettertochangeto/";
> #$workingcopy =~ tr/$lettertochange/$lettertochangeto/g;
> print "$cryptogram\nchanged to\n\n$workingcopy\n";
> &manual;
> }
Why are you using tr for this? I would suggest using s///; while tr/// is
normally faster, the introduction of the eval very likely causes it to
become much slower than s///.
Michael
--
Administrator www.shoebox.net
Programmer, System Administrator www.gallanttech.com
--
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]