, .
.
----- ---------------------------
->
- ++ --
**
! ~ \ + -
=~ !~
* / % x
+ - .
<< >>
-
- < > <= >= lt gt le ge
- == != <=> eq ne cmp
&
| ^
&&
||
- ..
?:
= += -= *= ..
, =>
-
not
and
or xor
.
, ,
, .
.
"".
( print(), ..)
(chdir(), ..) ,
. .
.
:
@i = ('a ','b ', print 'c ', 'd ');
print "\n",@i,"\n";
:
c d
a b 1
print.
, .
print
'c d' @i
print .
++ .
[...] {...} ,
.
, .
"".
.
1
.
.
.
(, , )
.
.
:
print ++($i = "09"); # "10"
print ++($i = "a9"); # "b0"
print ++($i = "az"); # "ba"
print ++($i = "aZ"); # "bA"
:
print 4**2 # 16
print -4**2 # -16 .. -(4**2)
'!' -
'-' -
'~' - ( 1)
'+' -
'\' - ( & )
"" =~ != .
""
. ""
. =~
(pattern - , , ) .
$_
. .
,
.
..
.
!= =~
( "").
"".
'*' -
'/' -
'%' -
'x' -
. ,
- .
:
print '*' x 5; # '*****'
print (1,2) x 3; # 121212
'+' -
'-' -
'.' - ()
'<<' -
.
'>>' -
.
. .
'<' -
'>' -
'<=' -
'>=' -
'lt' -
'gt' -
'le' -
'ge' -
'==' true ()
'!=' -
'<=>' - -1 , 0 ,
1 .
'eq' -
'ne' -
'cmp' - '<=>'
'&' - AND
'|' - OR
'^' - XOR
'&&' - false, .
'||' - true, .
,
0 1. .
.
.
- .
1.
..
.
.
:
for $i (1..4)
{ print "$i ";
}
: 1 2 3 4
- . '..'
. false
false.
true - true true,
- false.
'...'.
false
true.
'..' '&&' '||'.
flase - , true -
1. .
"E0"
.
:
@ = ('a'..'z'); #
@ = (0..9); #
'?:'
. '?'
':' - ':'.
:
$i = 1;
$i > 1 ? print "" : print "";
:
'=' - ""
..
$i += 2;
$i = $i + 2;
.
:
**=
+= -= .=
*= /= %= x=
&= |= ^=
<<= >>=
&&= ||=
'='.
,
.
.
not
. '!' .
. '&&'
"" . .
false - .
. '||'
"" . .
true - .
xor ( ).
.
.
:
& - . '\'.
* - .
(TYPE) - .
,
.
.
. '{}'
.
( '()', '[]', '{}', '<>')
.
---------- ------ ------------ ----
'' q{} Literal
"" qq{}
`` qx{}
qw{}
// m{}
s{}{}
tr{}{}
'$' '@' - ..
.
:
\t
\n
\r
\f
\v
\b backspace ()
\a
\e escape
\034
\x1a
\c[
\l
\u
\L \E
\U \E
\E
\Q \E
.
.
'\Q'.
.
//
.
.
.
/PATERN/gimosx
().
true (1) false ('').
'=~' '!~' $_
:
g - . .
i - ( )
m - .
o -
s -
x - .
'/' - 'm' .
.
PATTERN
() .
$) $| .
- /o.
.
PATERN -
.
($1, $2, $3...).
$1.
:
$a = "/usr/local/perl/perl.bin"; #
: @dirs .
:
split('\/')
.
@dirs =~ m[/(\w*)/(\w*)/(\w*)/(\w*)]
'm[' - .
(\w*) - .
@dirs ('usr', 'local', 'perl')
''
. .
\' \\ ' \ .
:
print q#.#; # .
print 'O\'K'; # O'K
qq//
""
.
:
$var = 13;
print "\$var = $var";
:
$var = 13
``
.
:
print `date`;
:
Thu Nov 14 13:36:49 MSK 1996
-
.
:
print qw/ !/; # ('','','!')
:
!
:
use POSIX qw( setlocale localeconv )
@EXPORT = qw( proc1 var );
.
false (0).
( =~ != )
$_ .
'/' (')
.
:
e - .
g - .
i -
m -
o -
s -
x -
'/' -
.
:
$var = "12345"; #
$var =~ s/1/0/; # '1' '0'. 02345
$var =~ s(5)(.); # '5' '.' 0234.
.
$var =~ s/\d*//; . '.'
$var =~ s///g; # '' ''. '.'
$var = "12 34"; #
$var =~ s/(\d\d) (\d\d)/$2 $1/; # . '34 12'.
y/1/2/cds
"1"
"2". - .
=~ != $_.
sed tr 'y'.
:
c - "1"
d - .
s - "" .
/d 2 .
2 1 1
. 2 - null
.
.
:
$s = "hello"; #
$s =~ tr/a-z/A-Z/; # .
# 'HELLO'
$s = 'Hel....lo';
$s =~ tr/a-zA-z/_/c; # '_'
# 'Hel____lo'
$s =~ tr/_/ /s; # '_' ' ' .
# 'Hel lo'
$s =~ tr/a-zA-Z /a-zA-Z/d; # . 'Hello'
1
.
-.
'`' - .
""
. ,
- - .
$? .
'<>'.
<> .
''
open().
'\n' - ,
.
false.
$_. STDIN -
.
:
while(<>) { print; }; # STDIN
'<>' .
,
.
.
- .
:
while(<*.pl>) { print;}; # ls *.pl
@files = <*>; # @files
: @files = glob("*"); ..
.
.
'\' , ,
,
.
,
:
use integer;
,
:
no integer;
Last-modified: Thu, 24 Apr 1997 18:01:40 GMT