Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Re (tilly) 2: Fore!!! (was The Perl Review)

by jackdied (Monk)
on Feb 02, 2002 at 10:06 UTC ( #142905=note: print w/replies, xml ) Need Help??


in reply to Re (tilly) 2: Fore!!! (was The Perl Review)
in thread The Perl Review

Could someone brief me on the y/// syntax? I took a look in man perlre, and tried stepping through it in the debugger - both were futile.

-jackdied

  • Comment on Re: Re (tilly) 2: Fore!!! (was The Perl Review)

Replies are listed 'Best First'.
Re (tilly) 4 (y): Fore!!! (was The Perl Review)
by tilly (Archbishop) on Feb 02, 2002 at 14:54 UTC
    y is a function which is explained in perlop. What it does is substitutes for any character in one list, the corresponding charater on another list.

    What I did was use ord and chr to figure out what the ASCII representation of 9 was, and what came right after that. Then I used tr to move the range A-Z so that they came right after the range 0-9, so that I could convert any digit into a number just by taking ord and subtracting off the ord of 0.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://142905]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2017-02-25 23:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?






    Results (369 votes). Check out past polls.