I know this is not a perl based solution but in general, when there is "unprintable character weirdness" in any text file or program script I am working with, I find the unix utility "od" to be very helpful. It provides an octal dump (or decimal, or hexadecimal in some versions) of each and every byte of the argument file. You can use it like this:
$ od -c <filename>
which will produce output similar to:
$ od -c innkeeper.pl
00000 # ! / u s r / l o c a l / b i n
00020 / p e r l \n \n u s e F i l e :
00040 : s t a t ; \n u s e F r e e z
00060 e T h a w q w ( f r e e z e
00100 t h a w ) ; # I m p o r t
00120 f r e e z e ( ) a n d t h a
00140 w ( ) \n \n % l i s t = ( ) ; \n \n
00160 $ A R G V [ 0 ] o r d i e
00200 " u s a g e : $ 0 d a t a f
00220 i l e \ n " ; \n \n o p e n ( I
00240 N , s h i f t ) ; \n \n w h i l
00260 e ( $ o b j = < I N > ) { \n
00300 c h o m p ( $ o b j ) ; \n (
00320 $ s , $ s o ) = t h a w ( $ o b
00340 j ) ; \n p r i n t " $ s =
00360 > " , " " . l o c a l t
00400 i m e ( $ s o - > m t i m e ) ,
00420 " \ n " ; \n } \n
You can see the decimal value of unprintable characters, and some common ones are given the well-known names like \n and \t, etc.
Hope this may help in the future.
When there is no wind, row.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.