emav has asked for the wisdom of the Perl Monks concerning the following question:
I've been trying to create I short routine based on hash arrays that should supposedly add letters to an ordinary array. It first checks if a letter has already been added to that array to avoid duplication.
I've tried all my tricks but the bloody (erm, excuse my French, brothers) thing keeps refusing to work. Can you have a look at the code and tell me what I'm missing.
May the Lord of Perl bless you abundantly!
Kyrie eleison!
PS: Here's the snippet...
The hash array that seems to be causing the trouble is %digit.
The comparisons that refuse to work are the first ones in the if-comparisons below.
for ($i=3; $i<=5; $i++) { $nv = join '',$big[$i],'v'; $nl = join '','l',$big[$i],'1'; $nm = join '','m',$big[$i],'1'; $nu = join '','u',$big[$i],'1'; if ($operation{$nv} eq 'plus') { $x = $digit{$nl}; if (@$x !~ /$digit{$nu}/ && $x ne $digit{$nu}) {push (@$x, $di +git{$nu});} if (@$x !~ /$digit{$nm}/ && $x ne $digit{$nm}) {push (@$x, $di +git{$nm});} } else { $x = $digit{$nu}; if (@$x !~ /$digit{$nl}/ && $x ne $digit{$nl}) {push (@$x, $di +git{$nl});} if (@$x !~ /$digit{$nm}/ && $x ne $digit{$nm}) {push (@$x, $di +git{$nm});} } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Comparison problem
by edan (Curate) on Oct 27, 2004 at 15:57 UTC | |
by emav (Pilgrim) on Oct 27, 2004 at 16:06 UTC | |
|
Re: Comparison problem
by borisz (Canon) on Oct 27, 2004 at 15:51 UTC | |
by emav (Pilgrim) on Oct 27, 2004 at 15:58 UTC | |
|
Re: Comparison problem
by Roy Johnson (Monsignor) on Oct 27, 2004 at 16:49 UTC | |
by emav (Pilgrim) on Oct 27, 2004 at 22:16 UTC | |
|
Re: Comparison problem
by Taulmarill (Deacon) on Oct 27, 2004 at 16:39 UTC | |
by emav (Pilgrim) on Oct 27, 2004 at 22:04 UTC | |
by jdporter (Paladin) on Oct 27, 2004 at 22:43 UTC | |
by emav (Pilgrim) on Oct 27, 2004 at 23:24 UTC | |
by jdporter (Paladin) on Oct 28, 2004 at 06:32 UTC |