# given that @abc[0,1,2] correspond to the C vars a, b, and c, respectively. my $i = $len-1; my $s = $len; $s <= 8 and $s--; $abc[$i/4] += $k[$i] << (($s%4)*8); # or, if you want to be too clever: $abc[$i>>2] += $k[$i] << (($s&3)<<3);