Difference between revisions of "Perl built-in functions"

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
Jump to navigation Jump to search
m (→‎A: spelling fix; arctangent probably could use an article...)
(→‎L: - O)
Line 97: Line 97:
 
*'''kill'''()
 
*'''kill'''()
 
===L===
 
===L===
*'''last'''()
+
* '''last'''()
*'''lc'''(''string'') - returns ''string'' in lowercase
+
* '''lc'''(''string'') - returns ''string'' in lowercase
*'''lcfirst'''(''string'') - returns ''string'' with first character lowercased
+
* '''lcfirst'''(''string'') - returns ''string'' with first character lowercased
 +
* '''length'''(''string'') - returns length (number of characters in) ''string''
 +
* '''link'''(''oldfile'',''newfile'') - creates ''newfile'' as a link to ''oldfile''
 +
* '''listen'''(''socket'',''queuesize'') - waits for incoming events on a socket
 +
* '''local'''(''variable list'') - makes all variables in ''variable list'' local to the current subroutine
 +
* '''localtime'''(''number'') - converts the binary time stored in ''number'' to a 9-element list and localizes it to the machine's timezone
 +
* '''log'''(''number'') - returns the [[natural logarithm]] (i.e. ''log<sub>e</sub>'') of ''number''
 +
* '''lstat'''(''fileHandle'') - returns file statistics for the file opened with file handle ''fileHandle'' (does not de-reference symbolic links)
 +
===M===
 +
* '''m'''''/pattern/''<u>gimosx</u> - performs pattern-matching; other characters may be used as delimiters instead of "/". See [[Perl regex]]
 +
* '''map'''(''expr'',''list'') - returns an array containing the output of ''expr(list item)'' for each item in ''list''
 +
* '''mkdir'''(''name'',''mode'') - creates a directory named ''name'' (can be relative or absolute filespec), with the file attributes in ''mode''. See [[mkdir]] for related information.
 +
* '''msgctl'''
 +
* '''msgget'''
 +
* '''msgrcv'''
 +
* '''msgsnd'''
 +
* '''my'''(''variable list'') - makes all variables in ''variable list'' local to the current {block}
 +
===N===
 +
* '''next'''
 +
* '''no'''
 +
===O===
 +
* '''oct'''(''expr'') - converts ''string'' from octal to decimal (query: is ''expr'' a string? BCD? integer?)
 +
* '''open'''(''fileHandle'',''name'') - opens a file named ''name'' and associates it with ''fileHandle''
 +
* '''opendir'''(''dirHandle'',''name'') - opens a directory named ''name'' and associates it with ''dirHandle''
 +
* '''ord'''(''string'') - returns the ASCII code of the first character in ''string'', as an integer

Revision as of 12:56, 24 February 2006

This page is a seed article. You can help HTYP water it: make a request to expand a given page and/or donate to help give us more writing-hours!

Computing: Programming: Perl: built-in functions

Alphabetical

A

  • abs(arg) - returns absolute value of arg
  • accept()
  • alarm($seconds) - sends an alarm signal after $seconds seconds
  • atan2($y,$x) - returns the arctangent of $y/$x

B

  • bind()
  • binmode(filehandle) - sets filehandle to be treated as binary
  • bless()

C

  • caller()
  • chdir()
  • chmod()
  • chomp()
  • chop()
  • chown()
  • chr()
  • chroot()
  • close()
  • closedir()
  • connect()
  • cos()
  • crypt()

D

  • dbmclose()
  • dbmopen()
  • defined()
  • delete()
  • die()
  • do subroutine
  • dump()

E

  • each()
  • endgrent
  • endhostent
  • endnetent
  • endprotoent
  • endpwent
  • endservent
  • eof()
  • eval()
  • exec()
  • exists($assoc($key)) - returns TRUE if $key exists within the hash $assoc. Doesn't work with dbm hashes.
  • exit()
  • exp()

F

  • fcntl()
  • fileno()
  • flock()
  • fork
  • format
  • formline()

G

  • getc()
  • getgrent
  • getgrgid()
  • getgrnam()
  • gethostbyaddr()
  • gethostbyname()
  • gethostent
  • getlogin
  • getnetbyaddr()
  • getnetbyname()
  • getnetent
  • getpeername()
  • getpgrp()
  • getppid
  • getpriority()
  • getprotobyname()
  • getprotobynumber()
  • getprotoent
  • getpwent
  • getpwnam()
  • getpwuid()
  • getserverbyname()
  • getserverbyport()
  • getservent
  • getsockname()
  • getsockopt()
  • glob()
  • gmtime()
  • goto()
  • grep()

H

  • hex()

I

  • index()
  • int()
  • ioctl()

J

  • join()

K

  • keys()
  • kill()

L

  • last()
  • lc(string) - returns string in lowercase
  • lcfirst(string) - returns string with first character lowercased
  • length(string) - returns length (number of characters in) string
  • link(oldfile,newfile) - creates newfile as a link to oldfile
  • listen(socket,queuesize) - waits for incoming events on a socket
  • local(variable list) - makes all variables in variable list local to the current subroutine
  • localtime(number) - converts the binary time stored in number to a 9-element list and localizes it to the machine's timezone
  • log(number) - returns the natural logarithm (i.e. loge) of number
  • lstat(fileHandle) - returns file statistics for the file opened with file handle fileHandle (does not de-reference symbolic links)

M

  • m/pattern/gimosx - performs pattern-matching; other characters may be used as delimiters instead of "/". See Perl regex
  • map(expr,list) - returns an array containing the output of expr(list item) for each item in list
  • mkdir(name,mode) - creates a directory named name (can be relative or absolute filespec), with the file attributes in mode. See mkdir for related information.
  • msgctl
  • msgget
  • msgrcv
  • msgsnd
  • my(variable list) - makes all variables in variable list local to the current {block}

N

  • next
  • no

O

  • oct(expr) - converts string from octal to decimal (query: is expr a string? BCD? integer?)
  • open(fileHandle,name) - opens a file named name and associates it with fileHandle
  • opendir(dirHandle,name) - opens a directory named name and associates it with dirHandle
  • ord(string) - returns the ASCII code of the first character in string, as an integer