Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: How to use a variable in tr///

by chanio (Priest)
on Apr 08, 2005 at 19:00 UTC ( #446114=note: print w/replies, xml ) Need Help??


in reply to How to use a variable in tr///

Two points to remember:
  • 1. I shouldn't trust so easily in what others say.
  • 2. I should frequently practice with my monitor some oneliners with the examples that I learn...
Why? This is what I have just tryed...

perl -e"$old='abc';$old = tr/a/z/g;print \"$old \n\";" Bareword found where operator expected at -e line 1, near "tr/a/z/g" syntax error at -e line 1, near "tr/a/z/g" Execution of -e aborted due to compilation errors.

There is no tr///g since every replacement is done on all the characters. So the /g would always be unnecesary. Just try it!

.{\('v')/}   C H E E R   U P !
 _`(___)' ___a_l_b_e_r_t_o_________
Wherever I lay my KNOPPIX disk, a new FREE LINUX nation could be established.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2018-09-22 10:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Eventually, "covfefe" will come to mean:













    Results (190 votes). Check out past polls.

    Notices?
    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!