Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_perl thread: hexadecimal questions


Message #1 by "Greg Barker" <gbarker02@h...> on Wed, 21 Mar 2001 14:47:52
Hi,
I?m in the process of creating a hexadecimal number generated by user 
input.
####################################################################
use integer;
print "Enter 1st #:  "; chomp ($first = <STDIN>);
print "Enter 2nd# :   "; chomp ($second = <STDIN>);

if ($fa =~/b\b/i){
	my ($number) = ('64');
	foreach $line1 (split("\n", $second)) {
	if ($line1 =~/(\w+)[a-z]/i){
		$second = $1;
 		$line2 = ($second+('16'-'1'));

$two = sprintf "%lX", ($first*$number)+$line2; 		
print "$two\n";
    		}
	}
######################################################################
If the 1st number is 182502171 and the 2nd number is 5b the result is 
B830C6D4.
I believe I?m NOT getting the full hexadecimal number.
This is a 8 digit number and the actual number would be 2B830C6D4 9 digits!
Is there a way to achieve this? It would appear to me that the? sprintf ?%
lX? ?has a short coming.
Please advise.
Greg
 


  Return to Index