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

Re: How to check if a word is reserved

by jsprat (Curate)
on Jun 13, 2003 at 00:16 UTC ( #265545=note: print w/replies, xml ) Need Help??

in reply to How to check if a word is reserved

Check keywords.h, located in the CORE directory in your perl tree. Contains a #define line for each keyword. Just parse it, strip off the unneeded cruft, place the words in a hash and there you go!


Replies are listed 'Best First'.
Re: Re: How to check if a word is reserved
by Popcorn Dave (Abbot) on Jun 13, 2003 at 04:30 UTC
    That's cool! I never knew about that, but I do have one question.

    I've got the following lines in my keywords.h file:

    #define KEY_x 249 #define KEY_xor 250 #define KEY_y 251

    xor I get as that's a function, but x and y are reserved? What gives?

    There is no emoticon for what I'm feeling now.

      It's hard to spot when they look paired like that, as they do wholly different things. Proof by example:

      perl -e 'print "x is a reserved word!\n" x 3;'
      perl -e '$a = "y is a _synonym_ for tr\n"; $a =~ y/_//d; print $a;'

      perl -pe '"I lo*`+$^X$\"$]!$/"=~m%(.*)%s;$_=$1;y^`+*^e v^#$&V"+@( NO CARRIER'

        Yes, now that you show me that, I see. That hadn't even occured to me last night. Must have been too tired. Thanks!

        There is no emoticon for what I'm feeling now.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://265545]
[marioroy]: LA my @music_times = qx(find \$HOME/Music/ Albums -type f -iname \'*.mp3\' -exec mp3info -p \"%S\\n\" {} \\;);
[marioroy]: Only 2 backslash \\n
[marioroy]: LA no space before Albums
[Lady_Aleena]: Good guh! I think I will use File::Find when working in perl. That is too many toothpicks.
[marioroy]: mp3info must be in the PATH
[marioroy]: LA ++
[Lady_Aleena]: marioroy, this is forcing me to learn perl modules to use instead.
[marioroy]: qx isn't fun if having to backslash ' and " and \.

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2017-04-23 21:26 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (432 votes). Check out past polls.