in reply to Play and win the word morph game with the help of Perl :)
Because you die if there are not two arguments on the command line there is no way that $left and $right will ever be assigned the values 'love' and 'shit'.die <<HELP unless @ARGV == 2; usage: transform.pl <word1> <word2> The program finds a way from one word to other, like this: % transform.pl love shit love-lose-lost-loot-soot-shot-shit HELP my $left = shift(@ARGV) || 'love'; my $right = shift(@ARGV) || 'shit';
You want to keep A-Z characters in a lc()ed string? What about non-ASCII lower case letters?for ($left, $right) { $_ = lc; tr/A-Za-z//cd; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Play and win the word morph game with the help of Perl :)
by Ieronim (Friar) on Jun 28, 2006 at 21:28 UTC | |
by jwkrahn (Abbot) on Jun 28, 2006 at 22:03 UTC | |
by Ieronim (Friar) on Jun 29, 2006 at 08:48 UTC |