Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Warnings and bitwise and

by Aim9b (Monk)
on Oct 12, 2007 at 18:59 UTC ( [id://644526]=note: print w/replies, xml ) Need Help??


in reply to Warnings and bitwise and

Thanks in no small part to several of the monks here, I have used the following routine to deal with some "flag bytes" in an IBM Mainframe file. A record is read into $inBuf, then fields are parsed out according to format.
... @Ind0 = BreakOut(substr($inBuf,6,1)); $Flag1= $Ind0[0]; ... $Flag7= $Ind0[7]; ... sub BreakOut { # Convert a single byte into an array of 8 1-bit flags # represented by a Y if ON, or an N if OFF. my $byte = shift; my @flag, $i; for ($i=0;$i<8;$i++) { if (vec($byte,$i,1)) { $flag[7-$i] = "Y"; } else { $flag[7-$i] = "N"; } # End If vec } # End For return @flag; } # End Sub BreakOut

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (2)
As of 2026-01-24 16:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your view on AI coding assistants?





    Results (126 votes). Check out past polls.

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.