CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
$string =~ tr/\x80-\xFF//d;

 



ChopperCharles
Novice

Oct 5, 2011, 9:11 AM

Post #1 of 2 (784 views)
$string =~ tr/\x80-\xFF//d; Can't Post

Given the command: $string =~ tr/\x80-\xFF//d;

what does that last 'd' do? tr/ translates on a char-by-char basis. \x80-\xFF acts on ascii chars > 127. // deletes the chars instead of replacing them with something else. But the 'd'?

Charles.


BillKSmith
Veteran

Oct 5, 2011, 9:26 AM

Post #2 of 2 (780 views)
Re: [ChopperCharles] $string =~ tr/\x80-\xFF//d; [In reply to] Can't Post

The /d is necessary for the delete behavior that your describe. Refer to options of the tr operator in perldoc perlop.
Good Luck,
Bill

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives