Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

How do i escape a '/' character when using tr?

by Anonymous Monk
on Aug 21, 2000 at 20:33 UTC ( [id://28839]=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I'm using tr to count the '/' characters in a string...unfortunately, I can't escape it with a '\' (perl barfs). Any ideas?
  • Comment on How do i escape a '/' character when using tr?

Replies are listed 'Best First'.
Re: How do i escape a '/' character when using tr?
by merlyn (Sage) on Aug 21, 2000 at 20:43 UTC
    That's odd.
    $count_slash = tr/\///;
    works just fine in my copy of Perl. Or you can use an alternate delimiter:
    $count_slash = tr#/##;

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2024-04-19 21:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found