Questions about this topic? Sign up to ask in the talk tab.

Perl/Basics/Boolean Logic/Bitwise Manipulations/Bit Shifting

From NetSec
Jump to: navigation, search

Perl > Basics > Boolean Logic > Bitwise Manipulations > Bit Shifting

  • << - The shift left operator
  • >> - The shift right operator

<syntaxhighlight lang="perl">my $num = 10; $num = $num << 2; #Shift left two bits $num = $num >> 2; #Shift right two bits print $num . "\n"; </syntaxhighlight>