toro_the_third has asked for the wisdom of the Perl Monks concerning the following question:
Hello, I'm new here and let me apologize for any inconvenience regarding this post.
so, my question is that I'm trying to make a script that reads 2 arguments and returns result of bit-wise operation AND.
#!/usr/bin/perl use strict; use warning; my $arg00=shift ( @ARGV ); my $arg01=shift ( @ARGV ); #printf $arg00+$arg01."\n"; printf sprintf( $arg00&$arg01 )."\n";
when I run test.pl 33 224, it returns result as 22.
if I run printf sprintf( 33&224 )."\n"; it returns 32.
also if I comment out the # before the printf, it also returns 32.
could any one give me an advice about this difference?
regards,
toro
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: bit-wise operation (+)
by tye (Sage) on Feb 28, 2012 at 06:42 UTC | |
by toro_the_third (Novice) on Feb 28, 2012 at 07:03 UTC | |
|
Re: bit-wise operation
by NetWallah (Canon) on Feb 28, 2012 at 06:13 UTC | |
by Anonymous Monk on Feb 28, 2012 at 06:35 UTC |