in reply to bit-wise operation

Both printf and sprintf take TWO arguments:

printf FORMAT, LIST
You supplied only one, so it prints the content of what you supplied.

Try using "%X" as a format, to print hex, or review the sprintf documentation for more options.

I do not have an explanation for your "32" result, but I can reproduce it. Perhaps a wiser monk ....

            “PHP is a minor evil perpetrated and created by incompetent amateurs, whereas Perl is a great and insidious evil perpetrated by skilled but perverted professionals.”
        ― Jon Ribbens

Replies are listed 'Best First'.
Re^2: bit-wise operation
by Anonymous Monk on Feb 28, 2012 at 06:35 UTC

    Hi, thank you for the prompt reply. I have fixed the printf part. but it still wouldn't work correct.

    [root@local]#cat test.pl #!/usr/bin/perl use strict; use warning; my $arg00=shift ( @ARGV ); my $arg01=shift ( @ARGV ); #printf $arg00+$arg01."\n"; printf( "%d", $arg00 & $arg01 ); [root@local]#./test.pl 33 224 <BR>22[root@local]#

    It should return 32 but returns 22.
    I cant figure out why this happens...
    regards,
    toro