Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

forming a word from an array of its bytes

by pidloop (Novice)
on Apr 07, 2021 at 22:14 UTC ( [id://11130974]=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my @array = (1, 2, 3, 4);
    my $val = 0;
    ...
        $val |= $array[$i]<<(8*$i);
    }
    printf "%d\n", $val;
    
  2. or download this
    perl -e 'printf "%d\n", (4<<24)+(3<<16)+(2<<8)+1')
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://11130974]
Approved by Bod
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (2)
As of 2024-05-24 02:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found