Loading an array

2004-09-01 Thread Shawn Sharp
I need some help, I am running this code to load values into the
$ArrayofCompareHex [$g] array.  Currently it is not working.  The
$comparevalue gets the correct value but the value is not past into the
array.  Here is a portion of my code.  Any ideas

 

230 my $g =0;

231 for ($g = 0; $g  $mps; ++$g)

 

{

239 $value = hex($ArrayofInput [$g]);

240 $ArrayofInputHex [$g] = $value;

241 $comparevalue = hex($ArrayofCompare [$g]);

242 $ArrayofCompareHex [$g] =$comparevalue;

}

 

thanks in advance



Re: Loading an array

2004-09-01 Thread David Greenberg
I'm no expert, but if I were to do what it looks like you are trying
to do, I would use the following code:

my @ArrayofInputHex = map { hex($_) }  @ArrayofInput;
my @ArrayofCompareHex = map { hex($_) } @ArrayofCompare;

One of the main benefits of this code is that when you use strict;
like you should, you don't have to worry about local variables inside
the loop.

Hope this helps,
David

On Wed, 1 Sep 2004 12:46:57 -0700, Shawn Sharp [EMAIL PROTECTED] wrote:
 I need some help, I am running this code to load values into the
 $ArrayofCompareHex [$g] array.  Currently it is not working.  The
 $comparevalue gets the correct value but the value is not past into the
 array.  Here is a portion of my code.  Any ideas
 
 230 my $g =0;
 
 231 for ($g = 0; $g  $mps; ++$g)
 
 {
 
 239 $value = hex($ArrayofInput [$g]);
 
 240 $ArrayofInputHex [$g] = $value;
 
 241 $comparevalue = hex($ArrayofCompare [$g]);
 
 242 $ArrayofCompareHex [$g] =$comparevalue;
 
 }
 
 thanks in advance
 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: Loading an array

2004-09-01 Thread Wiggins d Anconia
Your question may be better asked on [EMAIL PROTECTED] since it isn't
really CGI related.

 
 I need some help, I am running this code to load values into the
 $ArrayofCompareHex [$g] array.  Currently it is not working.  The
 $comparevalue gets the correct value but the value is not past into the
 array.  Here is a portion of my code.  Any ideas
 

Do you have strict/warnings enabled?  Where did $mps come from and what
does it contain?

http://danconia.org

  
 
 230 my $g =0;
 
 231 for ($g = 0; $g  $mps; ++$g)
 
  
 
 {
 
 239 $value = hex($ArrayofInput [$g]);
 
 240 $ArrayofInputHex [$g] = $value;
 
 241 $comparevalue = hex($ArrayofCompare [$g]);
 
 242 $ArrayofCompareHex [$g] =$comparevalue;
 
 }
 
  
 
 thanks in advance
 
 
 



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response