Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
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 surveying the Monastery: (6)
As of 2024-04-19 13:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found