in reply to Converting integer to bytes

As you recognised, you first need to convert the string "1" to the actual 8-byte big-endian integer.
my $eight_bytes = pack 'Q>', $user_id;
You can use unpack to get the hex representation back to verify it's correct:
my $hex = unpack 'H16', $eight_bytes;

Update: renamed $int to $eight_bytes as the value is not an integer in Perl's sense.

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]