{"id":500,"date":"2009-08-25T14:37:42","date_gmt":"2009-08-25T10:37:42","guid":{"rendered":"http:\/\/www.unixpin.com\/wordpress\/?p=500"},"modified":"2009-08-27T00:08:30","modified_gmt":"2009-08-26T20:08:30","slug":"perl-again","status":"publish","type":"post","link":"https:\/\/www.unixpin.com\/?p=500","title":{"rendered":"\u0421\u043d\u043e\u0432\u0430 perl. \u041d\u0435\u043c\u043d\u043e\u0433\u043e \u043e \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445"},"content":{"rendered":"<p>\u041f\u043e \u043c\u043e\u0442\u0438\u0432\u0430\u043c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 <a href=\"http:\/\/perldoc.perl.org\/perlvar.html\">Perlvar<\/a>.<\/p>\n<p>\u0421\u0447\u0438\u0442\u0430\u0442\u044c \u0446\u0435\u043b\u0438\u043a\u043e\u043c \u0444\u0430\u0439\u043b \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e:<\/p>\n<p><code>open (MOCK, $filename) or die \"$!\";<br \/>\nlocal $\/;<br \/>\n# \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u0443\u044e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \"\u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c \u0441\u0442\u0440\u043e\u043a\" ($\/ \u0438\u043b\u0438 $INPUT_RECORD_SEPARATOR \u0438\u043b\u0438 $RS)<br \/>\n$_ =&lt;MOCK&gt; ; \u00a0 \u00a0# \u0437\u0430\u0445\u0430\u0432\u0430\u0442\u044c <del datetime=\"2009-08-25T09:47:50+00:00\">\u043c\u043e\u0441\u043a <\/del>\u0444\u0430\u0439\u043b \u0446\u0435\u043b\u0438\u043a\u043e\u043c<br \/>\nclose (MOCK);<\/code><\/p>\n<p>\u041d\u0430\u043f\u0435\u0447\u0430\u0442\u0430\u0442\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u0430:<br \/>\n<code>@a=qw( 1 2fewf wf g ag f);<br \/>\nlocal $,=\"\\n\";<br \/>\n# \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u0443\u044e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \"\u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c \u043f\u043e\u043b\u0435\u0439\" ($, \u0438\u043b\u0438 $OUTPUT_FIELD_SEPARATOR \u0438\u043b\u0438 $OFS)<br \/>\nprint @a;<\/code><br \/>\n<!--more--><br \/>\n\u041f\u0435\u0447\u0430\u0442\u0430\u0442\u044c \u0432\u0441\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u043f\u043e\u0441\u043b\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 25<br \/>\n<code>perl -n -e 'print if $.&gt;25' file.txt  # \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u0443\u044e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \"\u043d\u043e\u043c\u0435\u0440 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0441\u0442\u0440\u043e\u043a\u0438\" ($. \u0438\u043b\u0438 $INPUT_LINE_NUMBER \u0438\u043b\u0438 $NR)<\/code><\/p>\n<p>\u041d\u0430\u043f\u0435\u0447\u0430\u0442\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0441\u0440\u0435\u0434\u044b:<br \/>\nperl -e &#8216;while ( ($a,$b)=each(%ENV) ) { print &#171;$a=$b\\n&#187;; }&#8217;; # \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u0445\u044d\u0448 %ENV, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0441\u0440\u0435\u0434\u044b \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f<\/p>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u043c\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b:<br \/>\n<code>print \"Usage: $0 [-k|--kill-all-humans]\\n\";<br \/>\n# \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u0443\u044e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \"\u0438\u043c\u044f \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b\" ($0 \u0438\u043b\u0438 $PROGRAM_NAME)<\/code><\/p>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432\u0435\u0440\u0441\u0438\u044e perl:<br \/>\n<code>print $];<br \/>\nprint $^V;<\/code><\/p>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443:<br \/>\n<code>print $^O;<br \/>\nprint POSIX::uname()<\/code>;<\/p>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u043a\u043e\u0433\u0434\u0430 \u0431\u044b\u043b\u0430 \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430:<br \/>\n<code>print $^T;<br \/>\n# \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445 \u0441 1970 \u0433\u043e\u0434\u0430, \u0441\u043c\u043e\u0442\u0440\u0438 time(). \u0412\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u0430\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f $^T \u0438\u043b\u0438 $BASETIME<\/code><\/p>\n<p>\u041d\u0430\u043f\u0435\u0447\u0430\u0442\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0441\u0440\u0435\u0434\u044b:<br \/>\n<code>perl -e 'while ( ($a,$b)=each(%ENV) ) { print \"$a=$b\\n\"; }';<br \/>\n# \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u0445\u044d\u0448 %ENV<br \/>\n<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u041f\u043e \u043c\u043e\u0442\u0438\u0432\u0430\u043c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 Perlvar. \u0421\u0447\u0438\u0442\u0430\u0442\u044c \u0446\u0435\u043b\u0438\u043a\u043e\u043c \u0444\u0430\u0439\u043b \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e: open (MOCK, $filename) or die &#171;$!&#187;; local $\/; # \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u0443\u044e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e &#171;\u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c \u0441\u0442\u0440\u043e\u043a&#187; ($\/ \u0438\u043b\u0438 $INPUT_RECORD_SEPARATOR \u0438\u043b\u0438 $RS) $_ =&lt;MOCK&gt; ; \u00a0 \u00a0# \u0437\u0430\u0445\u0430\u0432\u0430\u0442\u044c \u043c\u043e\u0441\u043a \u0444\u0430\u0439\u043b \u0446\u0435\u043b\u0438\u043a\u043e\u043c close (MOCK); \u041d\u0430\u043f\u0435\u0447\u0430\u0442\u0430\u0442\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u0430: @a=qw( 1 2fewf wf g ag f); local $,=&#187;\\n&#187;; # \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u0443\u044e [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23,24,25,4,93],"tags":[712,1019,711,710,722,713,716,715,721,723,437,475,714,717,718,724,720,719,297],"class_list":["post-500","post","type-post","status-publish","format-standard","hentry","category-perl","category-hpux","category-linux","category-solaris","category-unix-tru64","tag-perlvar","tag-perl","tag-var","tag-variable","tag-722","tag-713","tag-716","tag-715","tag-721","tag-723","tag-437","tag-475","tag-714","tag-717","tag-718","tag-724","tag-720","tag-719","tag-297"],"_links":{"self":[{"href":"https:\/\/www.unixpin.com\/index.php?rest_route=\/wp\/v2\/posts\/500","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.unixpin.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.unixpin.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.unixpin.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.unixpin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=500"}],"version-history":[{"count":5,"href":"https:\/\/www.unixpin.com\/index.php?rest_route=\/wp\/v2\/posts\/500\/revisions"}],"predecessor-version":[{"id":505,"href":"https:\/\/www.unixpin.com\/index.php?rest_route=\/wp\/v2\/posts\/500\/revisions\/505"}],"wp:attachment":[{"href":"https:\/\/www.unixpin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=500"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.unixpin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=500"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.unixpin.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=500"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}