Apr 12, 2010, 8:00 PM
Post #4 of 4
Re: [csudess] Add two hexadecimal value
[In reply to]
i mean here is my number
What do you think the double quote operator does in perl? Does it create numbers?
Let's try a simple test:
my $numb1 = "\x64";
So there is some empirical evidence, right there, that perl's double quote operator returns strings--not numbers. And in fact, the hex escape format \xNN, is used to insert characters into a double quoted *string* using their ascii codes.
perl provides another hexidecimal format when you want to create *numbers* using hex format in your source code:
my $total = 0x01 + 0x03;
1) Search google for 'code tags'. Read the first 10 results and come back and post what you have learned.
2) Start all your programs with the following lines:
use 5.010; #if using perl 5.10+
3) Declare all variables with my(), e.g.:
my($num1, $num2) = (3, 4);
4) Use the 3-arg form of open(), and use a variable instead of a bareword filehandle:
open my $INFILE, '<', 'data.txt'
or die "Couldn't open data.txt: $!";
(This post was edited by 7stud on Apr 12, 2010, 11:37 PM)