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

Re^3: Illegal character CTRLCHAR code 27

by moritz (Cardinal)
on May 03, 2010 at 09:26 UTC ( #838049=note: print w/replies, xml ) Need Help??


in reply to Re^2: Illegal character CTRLCHAR code 27
in thread Illegal character CTRLCHAR code 27

I think you're not testing your code properly:
$ perl -wE '$_="\01\02"; say length; tr/\000-\007//; say length' 2 2

Nothing removed. (Update: But replaced, see Re^5: Illegal character CTRLCHAR code 27) Still you're on the right track. For deleting with tr///, you need a trailing /d:

$ perl -wE '$_="\01\02"; say length; tr/\000-\007//d; say length' 2 0
Perl 6 - links to (nearly) everything that is Perl 6.

Replies are listed 'Best First'.
Re^4: Illegal character CTRLCHAR code 27
by ultranerds (Hermit) on May 03, 2010 at 09:32 UTC
    Ah ok - thanks for the heads up - have updated my code :) (weird though, as it seemed to get rid of that error I reported in my first post, even without the /d ?)

    Cheers

    Andy
      Your code was replacing control chars with a space. moritz's is deleting them.
        Ah ok - thanks for clearing that up :)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (2)
As of 2022-05-18 16:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (71 votes). Check out past polls.

    Notices?