On Thursday 18 April 2002 6:57 pm, Allison Ogle wrote:
> Maybe it is because I am assigning my array to a line from another document
> and not assigning letters dirtectly to the array because it still doesn't
> work.  It could be there is something wrong with my code too.
>
>
> $word=<DATA>;  #where <DATA> is the filehandle and therefore $word gets the
> string from the inputfile.  Something like ABCD for example
> chomp $word;
> @code = split //,$word; #this assigns thestring to the array @code.  The
> values stored in @code are now A B C D
> $y=0;
> if($code[$y] ne "F"){
>       print "$code[$y]\n";
>       $code[$y]=$code[$y]+1;

I think this is your problem.  You're adding a number to a letter which I 
think is getting evaluated to adding 0  to 1 which if course is 1.

What you actually want is 

$code[$y]++;

>       print "$code[$y]\n";}
>
> This prints A and then 1.  I can't figure out why. Is there something wrong
> with my coding?  Thanks for the help so far.
>
> Allison

-- 
Gary Stainburn
 
This email does not contain private or confidential material as it
may be snooped on by interested government parties for unknown
and undisclosed purposes - Regulation of Investigatory Powers Act, 2000     

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to