Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re: Illegal character CTRLCHAR code 27

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

in reply to Illegal character CTRLCHAR code 27


You have 108 writeups here at perlmonks - you still don't know how to write a regex/substitution to remove a character from a string? Or if you don't remember how to do it, you don't know how to find the documentation that explains it?

Then let me point you at and hope that you bookmark and/or remember the address.

Replies are listed 'Best First'.
Re^2: Illegal character CTRLCHAR code 27
by ultranerds (Hermit) on May 03, 2010 at 09:19 UTC

    I know how to remove a charachter, but wasn't sure what to use for the control charachter (as I've never had to do that)

    This seems to do the trick though:

    $user->{$col} =~ tr/\000-\037/ /;


      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.
        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 ?)



Log In?

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2022-08-16 10:09 GMT
Find Nodes?
    Voting Booth?

    No recent polls found