#!/usr/bin/perl $d = "4653896912"; $b = "13"; $z = hex(80000000); print "1: $z\n"; if($z & $d){ $d = ($d>>1); $d &= (~$z); $d |= 0x40000000; $d = ($d>>($b-1)); }else{ $d = ($d>>$b); } print "2: $d\n"; exit;