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

Dear Monks,
How I can find all the built-in functions and keywords in perl, programatically?

Thanks,
artist

Replies are listed 'Best First'.
Re: Perl functions
by Abigail-II (Bishop) on Feb 27, 2003 at 16:17 UTC
    Read in the file keywords.pl from the perl source distribution, and look at the lines after __END__.

    Abigail

Re: Perl functions
by tachyon (Chancellor) on Feb 27, 2003 at 17:12 UTC

    You can also find them in keywords.h, but that was probably what Abigail-II meant. Here they are for your enjoyment (perl 5.6.1):

    NULL __FILE__ __LINE__ __PACKAGE__ __ +DATA__ __END__ AUTOLOAD BEGIN CORE DE +STROY END EQ GE GT IN +IT LE LT NE CHECK ab +s accept alarm and atan2 bi +nd binmode bless caller chdir ch +mod chomp chop chown chr ch +root close closedir cmp connect co +ntinue cos crypt dbmclose dbmopen de +fined delete die do dump ea +ch else elsif endgrent endhostent en +dnetent endprotoent endpwent endservent eof eq + eval exec exists exit ex +p fcntl fileno flock for fo +reach fork format formline ge ge +tc getgrent getgrgid getgrnam gethostbyaddr ge +thostbyname gethostent getlogin getnetbyaddr getnetbyname ge +tnetent getpeername getpgrp getppid getpriority ge +tprotobyname getprotobynumber getprotoent getpwent getpwnam ge +tpwuid getservbyname getservbyport getservent getsockname ge +tsockopt glob gmtime goto grep gt + hex if index int io +ctl join keys kill last lc + lcfirst le length link li +sten local localtime lock log ls +tat lt m map mkdir ms +gctl msgget msgrcv msgsnd my ne + next no not oct op +en opendir or ord our pa +ck package pipe pop pos pr +int printf prototype push q qq + qr quotemeta qw qx ra +nd read readdir readline readlink re +adpipe recv redo ref rename re +quire reset return reverse rewinddir ri +ndex rmdir s scalar seek se +ekdir select semctl semget semop se +nd setgrent sethostent setnetent setpgrp se +tpriority setprotoent setpwent setservent setsockopt sh +ift shmctl shmget shmread shmwrite sh +utdown sin sleep socket socketpair so +rt splice split sprintf sqrt sr +and stat study sub substr sy +mlink syscall sysopen sysread sysseek sy +stem syswrite tell telldir tie ti +ed time times tr truncate uc + ucfirst umask undef unless un +link unpack unshift untie until us +e utime values vec wait wa +itpid wantarray warn while write x + xor y

    cheers

    tachyon

    s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

      No, I didn't mean that. keyword.h is generated from keywords.pl.

      Abigail

Re: Perl functions
by Elian (Parson) on Feb 27, 2003 at 17:38 UTC
    I presume you're actually looking to have some sort of introspective capabilities you use at runtime, rather than grovelling in some way through perl's source distribution. In that case, the answer is "you can't". Sorry.
Re: Finding Perl built-in functions
by diotalevi (Canon) on Mar 25, 2003 at 02:15 UTC

    Use B::Keywords. I just uploaded it to CPAN the other day. You'll find all the internal function names in @B::Keywords::Barewords (and some other things).