Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

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?

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2021-04-13 10:12 GMT
Find Nodes?
    Voting Booth?

    No recent polls found