Perl
![]() |
|
| : |
: , -, |
|---|---|
| : | |
| : |
1987 |
| (): | |
| : |
.pl, .pm, .cgi |
| : |
5.14.2 / 26 2011 |
| : |
5.14.3 / 21 2011 |
| : | |
| : | |
| : | |
Perl , , . , Practical Extraction and Report Language « »[1]. pearl («»). , (. PEARL (.)), «a» . Perl , , .
Perl CPAN, http://www.cpan.org.
|
|
[]
[]
Perl 1987 , Unisys[2]. 1.0 comp.sources.misc 18 1987 [3] « awk sed».
Perl 2 1988 . . Perl 3, 1989 , .
, Perl ( ) man-. 1991 «Programming Perl» ( « » (Camel Book) - ), , -, . , «» 4 , , , , .
[] Perl 5
Perl 4 , Perl 4.036 1993 . , Perl 4 Perl 5. Perl 5 1994 . perl5-porters Perl 5 . , Perl 5[4].
Perl 5.000 17 1994 .[5] , , , , , (my $var_name) . , . , , Perl- . Perl 5 .
Perl 5.001 13 1995 . Perl 5.002 29 1996 . , , Perl. Perl 5.003 25 1996 .
Perl 5 . 26 1995 CPAN (Comprehensive Perl Archive Network « Perl»), Perl, . 20 000 , 8 000 [6].
Perl 5.004 15 1997 , , UNIVERSAL, , . . Perl Microsoft Windows, .
Perl 5.005 22 1998 . , B::*, qr// , , , , BeOS.
[] C 2000
Perl 5.6 22 2000 . 64- , , ( 2 ) «our»[7][8]. Perl 5.6 . 5.005_63 5.5.640; , , .
2000 Perl. 361 RFC (Request for Comments « »), Perl 6. 2001 [9] , Perl. , RFC. Perl 6 .
Perl 5.8 18 2002 . Perl 5.8 5.8.9 14 2008 . Perl 5.8 , /, , [10].
2004 C (Synopsis) , , . Perl 6. 2005 Audrey Tang Pugs[11] Perl 6, Haskell[12]. Perl 6 . 2006 .
18 2007 , 20- Perl 1.0, Perl 5.10.0. , Perl 6. switch ( «given»/«when»), , «» «~~»[13][14].
Perl 6, Rakudo Perl [15], Parrot. C 2009 Rakudo Perl Perl 6.
Perl 5 Perl 5.11. , .
12 2010 Perl 5.12.0 . package NAME VERSION, Yada Yada ( -, ), 2038 (Y2038), , DTrace ( ), Unicode 5.2[16]. 7 2010 Perl 5.12.2. , [17].
, 26 2011 Perl 5.14.2[18].
[] Perl 6
2000 (6-) . , . Perl 6, . perl6.ru.
[]
Perl , , , , -, , , , .
( , , ), (, )[19]. (, - ), ( , ), , .
, Perl . « » («Theres more than one way to do it»), TMTOWTDI. « , » («Easy things should be easy and hard things should be possible»).
[]
Perl UNIX. , (, , , ). , . Perl , , , .
Perl Lisp, AWK sed, AWK (« »). , .
Perl 5 , ( ) . , , , , (, strict). , Perl 5, «» (package) . , « Perl 5 Perl, »[20].
[] Perl
Perl , AWK, sed Bourne shell.
«#!///Perl [-]» Perl UNIX -. shell, Perl , .
[]
«Hello, world!» :
#!/usr/bin/perl print "Hello, world!\n";
CGI:
#!/usr/bin/perl print "Content-type: text/html\n\n"; print "Hello, world!";
post modern web-framework
use Mojolicious::Lite; get '/' => {text => 'Hello World!'}; app->start;
my $app = sub { return [200, ['Content-Type' => 'text/plain'], ["hello, world\n"]]; }
.
$x = 5; $x .= 0; print $x; #50
print 1, 0 x 100;
[]
: , , -, , , . , :
| $ | $foo | ; , , , . | |
| @ | @foo | . | |
| - | % | %foo | -; , . . |
| $foo FOO | , / . | ||
| & | &foo | , , . | |
| * | *foo | 'foo'. |
[]
$x = 10; # $y = $x + 1; # $x $z = $x . 'string'; # $ref = \$x; # $ref $x $$ref = 0; # $x 0
. Perl . , , . :
## $pi = 3.141592654; $var1 = ' Pi - $pi\n'; print $var1; # Pi - $pi\n $var2 = " Pi - $pi\n"; print $var2; # Pi - 3.141592654
, , \". \'. , Perl . , q ( ) qq ( ):
## $pi = 3.141592654; $link1 = q{<a href="/Pi">$pi</a>}; print $link1; # <a href="/Pi">$pi</a> $link2 = qq{<a href="/Pi">$pi</a>}; print $link2; # <a href="/Pi">3.141592654</a>
Perl . , Perl. \n:
## UNIX $space = `du -s -k /usr/local/bin`; print $space; # 6264 /usr/local/bin $sysuptime = `uptime`; print $sysuptime; # 2:24 up 1 day, 9:05, 1 user, load averages: 0.26 0.32 0.33
[]
@array = (1,2,3,4); # @array print $array[2]; # print @array[2,3]; # . # @, .
[] -
- , (, ).
%hash = ( 'cat' => 'kitten', # => - " ", 'dog' => 'puppy', # ",". 'cow' => 'calf' ); print $hash{'cat'}; # kitten print join("-", keys %hash) ; # . cat-dog-cow print join("-", values %hash) ; # . kitten-puppy-calf print join("-", %hash) ; # cat-kitten-cow-calf-dog-puppy, # (, ). , # .
[]
- . - . return, . return , undef, .
sub printTwo{ print 2; } sub three{ 3; } $s = \&three; print &$s; # 3 $s = \&printTwo; # $s - . print &$s; # 21. `2` , `1` , printTwo print &printTwo #
[]
- . . constant, . :
use constant MY => 2; print MY;
[]
- , , , , , PIPE , , .
:
$s = <STDIN>; # STDIN ( ); . @values = <FILE>; # FILE ; . print STDOUT $s; # STDOUT ( )
Perl , .
[]
Perl , , (). bless. Perl . , .
, « », cpan- Moose / Mouse, MooseX::Declare. Moose , BBC Cisco[21].
[]
m// . $x =~ m/abc/ , $x abc. :
$x =~ /abc/ |
$x () «abc». «m» // . |
$x =~ m/a(.{1,3})c/ |
$x «a», «\n», «c». $1. |
$x =~ m{^p(erl|ugs)$}i |
$x «perl» «pugs» . , // {}. |
s///. $x =~ s/abc/def/; abc def.
$x =~ s/abc/def/g; |
( /g global) «abc» $x «def». |
$x =~ s/a(.{1,3})c/!$1!/; |
$x «a», «\n», «c» «a» «c», «!». , «syntactic» «synt!cti!». |
$x =~ s{^p(erl|ugs)}{"P" . lc $1}ieg; |
/e, , , . «perl» «pugs» «Perl» «Pugs», . |
(??{ Perl }) Perl (?{ Perl }) . , .
Perl , , PHP JavaScript, , .
[]
Perl one-liners , -e.
perl -wle '(1 x $_) !~ /^(1|((11+)\3+))$/ && print while ++ $_'
file, -n , , :
perl -ne '$s{$_}++ || print' file
: Windows ' ".
Perl J.
,[22] ( ):
echo "test... test... test..." | perl -e '$??s:;s:s;;$?::s;;=]=>%-{<-|}<&|`{;;y; -/:-@[-`{-};`-{/" -;;s;;$_;see'
echo "test... test... test..." , , . - . . :
$? ? s:;s:s;;$?: : s;;=]=>%-{<-|}<&|`{; ; y; -/:-@[-`{-};`-{/" -; ; s;;$_;see
$? . , $? 0, «» s;;=]=>%-{<-|}<&|`{;. , , - $_ =]=>%-{<-|}<&|`{ ( s , '/' '|', ';').
«» . , . , :
!"#$%&'()*+,-./:;<=>?@[\]^_`{|} `abcdefghijklmnopqrstuvwxyz{/" -
$_
system"rm -rf /"
[]
Perl , . , Icon « », .
[] Perl
Perl . «Black Perl» (« » « ») Usenet. Perl 3, , , Perl 5.
BEFOREHEAD: close door, each window & exit; wait until time. open spellbook, study, read (scan, select, tell us); write it, print the hex whole each watches, reverse its length, write again; kill spiders, pop them, chop, split, kill them. unlink arms, shift, wait & listen (listening, wait), sort the flock (then, warn the "goats" & kill the "sheep"); kill them, dump qualms, shift moralities, values aside, each one; die sheep! die to reverse the system you accept (reject, respect); next step, kill next sacrifice, each sacrifice, wait, redo ritual until "all the spirits are pleased"; do it ("as they say"). do it(*everyone***must***participate***in***forbidden**s*e*x*). return last victim; package body; exit crypt (time, times & "half a time") & close it, select (quickly) & warn your next victim; AFTERWORDS: tell nobody, wait, wait until time; wait until next year, next decade; sleep, sleep, die yourself, die at last
[]
- Padre IDE (.)
- PSPad
- ActiveState Komodo
- jEdit
- EPIC Perl Editor and IDE for Eclipse
- Geany
- IDM Computer Solutions, Inc. UltraEdit & UEStudio
- Notepad++
- Gedit
- SciTE
- Emacs
[]
- Perl perldoc.perl.org (.)
- Larry Wall.( ) 20 2006.
- Perl, a «replacement» for awk and sed. 18 2007.
- perl5-porters
- Perl perldoc.perl.org (.)
- perl.org CPAN page. 28 2012.
- perl56delta perldoc.perl.org
- perl561delta perldoc.perl.org
- Apocalypse 1: The Ugly, the Bad, and the Good dev.perl.org (.)
- perl58delta perldoc.perl.org
- en:Pugs
- HaskellWiki
- perldelta: what is new for perl 5.10.0
- Smart matching in detail
- en:Rakudo Perl
- perl5120delta search.cpan.org
- perl5122delta search.cpan.org
- perl-5.14.2. 28 2012. 26 2011.
- perlintro(1) man page
- Usenet post, May 10, 1997, with ID 199705101952.MAA00756@wall.org
- moose A Postmodern Object System for Perl
- Perl
- perlfaq3 perldoc.perl.org
[] .
[]
- www.cpan.org CPAN Perl
- Perldoc Perl
- Perl enciLinuxFormat
- Perl Open Directory Project (dmoz).
[]
- , , . Perl = Programming Perl. .: O'Reilly, «», 2008. 1145 . 4500 . ISBN 5-93286-020-0
- . , , . Perl. .: O'Reilly, «», 2009. . 377. ISBN 978-5-93286-154-7
- . , . . Perl: . .: O'Reilly, «», 2007. . 320. ISBN 978-5-93286-093-9
- , . Perl. . = Perl Cookbook. .: O'Reilly, «», 2004. 928 . ISBN 5-94723-855-1
- . Perl: = Perl: Your Visual Blueprint for Building Perl Scripts. .: «», 2001. 280 . ISBN 0-7645-3478-5
- . . Perl = Network Programming with Perl. .: Addison Wesley, «», 2001. 752 . 4000 . ISBN 5-8459-0222-3


