Vladimir Maslov. Vvedenie v Perl
Soderzhanie
Primer 1 Vvedite v fajl test1.pl sleduyushchie stroki:
Primer 2 Dannaya programma vyvodit na ekran vse vashi sekrety. A imenno fajl /etc/passwd.
Primer 3 Razdeleneie polej.
Primer 4 Vyvesti imena pol'zovatelej otsortirovannyh po gruppam.
Sintaksis:
Klyuchi:
-Ocifry
-a
-c
-d
-Dchislo ili Dspisok
-e komanda
-F shablon
-irasshirenie
-Idirektoriya
-lchislo
-n
-p
-P
-s
-S
-T
-u
-U
-v
-w
-x direktoriya
Deklaracii (ob®yavleniya).
Prostoe predlozhenie.
Slozhnye predlozheniya.
Operatory upravleniya ciklom.
Cikl for.
Cikl foreach.
Bloki i operator switch.
Operator goto.
POD operatory. Dokumentirovanie programm.
Primer:
Primer:
Kontekst.
Skalyarnye znacheniya.
Konstruktory spiskov.
Tip typeglobs
$_
$ARG
$cifra
$&
$`
$'
$+
$.
$/
$|
$,
$\
$"
$;
$#
$%
$=
$-
$~
$^
$:
$^L
$^A
$?
$!
$@
$$
$<
$>
$(
$)
$O
$[
$]
$^D
$^F
$^I
$^P
$^T
$^W
$^X
$ARGV
@ARGV
@INC
%INC
$ENV{vyrazhenie}
$SIG{vyrazhenie}
Pel versii 5 soderzhit dopolnitel'nye konstrukcii shablonov:
Pravila regulyarnogo vyrazheniya. (regex)
Termy i levostoronnie spiskovye operatory.
Operator '->'
Operatory ++ (inkrement) i -- (dekrement).
Unarnye operatory.
Operatory "privyazki" =~ i !~ .
Mul'tiplikativnye operatory.
Additivnye operatory.
Operatory sdviga.
Imenovannye unarnye operatory.
Operatory otnoshenij.
Operatory ravenstva.
Operatory raboty s bitami.
Logicheskie operatory && (AND) i || (OR).
Operator diapazona '..'
Operatory prisvaivaniya.
Operator ',' (zapyataya)
Operator logicheskoe not (oricanie).
Operator logicheskoe and (I).
Logicheskoe or (ILI).
S operatory otsutstvuyushchie v Pel.
Operatory ogranichiteli strok.
?PATERN?
m/PATERN/gimosx
q/stroka/
qx/stroka/
qw/stroka/
s/shablon/podstroka/egimosx
tr/tablica1/tablica2/cds
Operatory vvoda-vyvoda.
Sliyanie konstant.
Celochislennaya arifmetika.
Operator '-X'.
abs vyrazhenie
accept NEWSOCKET, GENERICSOCKET
alarm sekundy
atan2 Y, X
bind sokit, imya
binmode fajl
bless ssylka, klass
caller vyrazhenie
chdir vyrazhenie
chmod spisok
chomp peremennaya
chop peremennaya
chown spisok
chr chmslo
chroot direktoriya
close fajl
closedir direktoriya
connect sokit, imya
cos vyrazhenie
crypt tekst, salt
dbmclose hesh
dbmopen hesh, baza, rezhim
define vyrazhenie
delete vyrazhenie
die spisok
do BLOCK
do podprogramma
do vyrazhenie
dump metka
each hesh
eof fajl
eval vyrazhenie
exec spisok
exists vyrazhenie
exit vyrazhenie
exp vyrazhenie
fcntl fajl, funkciya, skalyar
fileno fajl
flock fajl, operaciya
fork
format
formline format, spisok
getc fajl
getlogin
getpeername sokit
getpgrp PID
getppid
getpriority WHICH, WHO
getsockname sokit
getsockopt sokit, uroven', opciya
glob vyrazhenie
gmtime vyrazhenie
goto metka
grep blok, spisok
hex vyrazhenie
import
index stroka, podstroka, poziciya
ioctl FILEHANDLE, FUNCTION, SCALAR
join vyrazhenie, spisok
keys hesh
kill spisok
last metka
lc vyrazhenie
lcfirst vyrazhenie
length vyrazhenie
link OLDFILE, NEWFILE
listen SOCKET, QUEUESIZE
local spisok
localtime vyrazhenie
log vyrazhenie
lstat fajl
m//
map blok, spisok
mkdir direktoriya, prava
msgctl ID, CMD, ARG
msgget KEY, FLAGS
msgsnd ID, MSG, FLAGS
msgrcv ID, VAR, SIZE, TYPE, FLAGS
my spisok
next metka
no Module spisok.
oct vyrazhenie
open fajl,vyrazhenie
opendir ukazatel', vyrazhenie
ord vyrazhenie
pack shablon, spisok
pipe READHANDLE, WRITEHANDLE
pop massiv
pos skalyar
print fajl spisok
printf fajl spisok
push massiv, spisok
q/stroka/
quotemeta vyrazhenie
rand vyrazhenie
read fajl, skalyar, dlina, smeshchenie
readdir direktoriya
readlink vyrazhenie
recv SOCKIT, SCALAR, LEN, FLAGS
redo metka
ref vyrazhenie
rename staroe_imya, novoe_imya_fajla
require vyrazhenie
reset vyrazhenie
return spisok
reverse spisok
rewindir direktriya
rindex stroka, podstroka, poziciya
rmdir direktoriya
s/// Operator podstanovki. Smotri glavu "Operatory".
scalar vyrazhenie
seek fajl, poziciya, otschet
seekdir direktoriya, poziciya
select fajl
semctl ID, SEMNUM, CMD, ARG
semget KEY, NSEMS, FLAGS
semop KEY, OPSTRING
send SOCKET, MSG, FLAGS, TO
setpgrp PID, PGRP
setpriority WHICH, WHO, PRIORITY
setsockopt SOCKET, LEVEL, OPTNAME, OPTVAL
shift massiv
shmctl ID, CMD, ARG
shmget KEY, SIZE, FLAGS
shutdown SOCKET, HOW
sin vyrazhenie
sleep vyrazhenie
socket SOCKET, DOMAIN, TYPE, PROTOCOL
socketpair SOCKET1, SOCKET2, DOMAIN, TYPE, PROTOCOL
sort podprogramma spisok
splice massiv, smeshchenie, dlina, spisok
split /shablon/, vyrazhenie, predel
sprintf format, spisok
sqrt vyrazhenie
srand vyrazhenie
stat fajl
study skalyar
substr vyrazhenie, smeshchenie, dlina
symlink staryj_fajl, novyj_fajl
syscall spisok
sysread fajl, skalyar, dlina, smeshchenie
system spisok
syswrite fajl, skalyar, dlina, smeshchenie
tell fajl
telldir direktoriya
tie peremennaya, klass, spisok
time
times
uc vyrashchenie
ucfirst vyrazhenie
umask vyrazhenie
undef vyrazhenie
unlink spisok
unpack shablon, vyrazhenie
untie peremennaya
unshift massiv, spisok
use modul' spisok
utime spisok
values hesh
vec vyrazhenie, smeshchenie, bit
wait
waitpid PID, FLAGS
wantarray
warn spisok
write fajl
y///
Private peremennye.
Prototipy (prototypes).
Ssylka kak parametr.
Pereopredelenie vstroennyh funkcij.
Avtozagruzka.
Tablicy imen.
Konstruktory i destruktory.
Klassy.
Sozdanie biblioteki.
Standartnye Pel biblioteki.
V standartnyj nabor vhodyat sleduyushchie pragma:
CPAN
Ochen' poleznye USENET konferencii:
WWW servera:
Size: 129751 bytes
Last-modified: Sun, 02 Jul 2000 22:34:02 GMT
I kusochkami po 40Kb: [1][2][3][4]