Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: To read Char-by-Char from a file

by cog (Parson)
on May 12, 2005 at 11:07 UTC ( [id://456343]=note: print w/replies, xml ) Need Help??


in reply to To read Char-by-Char from a file

As long as each character has one byte:

$/ = \1;

Assigning $/ to a reference to an integer makes it separate input on each $x bytes ($x here being the integer).

Note: Bytes, not characters.

Try it out:

perl -pe 'BEGIN{$/=\1}s/.*/<$&>/' file

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (8)
As of 2024-04-18 10:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found