 $tmp1 = recreate(@hidden{&#39;bit7&#39;,&#39;bit6&#39;,&#39;bit5&#39;});

        my $tmp2 = pdl(byte(),$tmp1);
        $hidden{data} = $tmp2-&gt;xchg(0,1);</code></pre>

<h3 id="res-recreate-bit7-bit6-bit5">$res = recreate($bit7,$bit6,$bit5)</h3>

<p>To put Bits 7/6/5 together I have to iterate through every value of that image matrix (array). Each bit needs to be shifted from bit position 0 (LSB) to the appropriate position (7/6/5). Afterwards the Bytes with the proper bit position needs to be binary ORe