in reply to printing hexadecimal without printf

I do not understand your question. Your current script produces the following output:
1: 33 2: 45 3: 57 4: 69 5: 81 ...
I modified your code so that it would print out the value of the $a variable in hexadecimal notation (with a "0x" prefix), using the Perl built-in function printf:
#!/usr/bin/env perl use warnings; use strict; my $a=0x15; for (my $i = 1; $i <= 100; $i++) { $a+=0x0C; print "$i: "; printf "0x%x\n", $a; }
This is the new output:
1: 0x21 2: 0x2d 3: 0x39 4: 0x45 5: 0x51 ...
If this is not the output you are looking for, please provide a small sample of your desired output.

Please also state a reason why you do not want to use printf.

Replies are listed 'Best First'.
Re^2: printing hexadecimal without printf
by Fletch (Bishop) on Nov 26, 2007 at 14:31 UTC