Angerstein wrote:
I have a Line of code I just donīt know waht it does.
Especialy the underlined section:
All used vars are scalars.
my $d = (($facility_i<<3)|($priority_i));
--------------
Its from Net::Syslog syslog.pm line 93.
perldoc perlop
[snip]
Shift Operators
Binary "<<" returns the value of its left argument shifted left by the
number of bits specified by the right argument. Arguments should be
integers. (See also "Integer Arithmetic".)
Binary ">>" returns the value of its left argument shifted right by the
number of bits specified by the right argument. Arguments should be
integers. (See also "Integer Arithmetic".)
Note that both "<<" and ">>" in Perl are implemented directly using
"<<" and ">>" in C. If "use integer" (see "Integer Arithmetic") is in
force then signed C integers are used, else unsigned C integers are
used. Either way, the implementation isn't going to generate results
larger than the size of the integer type Perl was built with (32 bits
or 64 bits).
The result of overflowing the range of the integers is undefined
because it is undefined also in C. In other words, using 32-bit
integers, "1 << 32" is undefined. Shifting by a negative number of
bits is also undefined.
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>