Perl - PowerPoint PPT Presentation

1 / 20
About This Presentation
Title:

Perl

Description:

???????? ??????? ?? ?????. ?????????? ?????????. ??????? ? ???????? ... print 'triple chick bonus: '.($a x 3); ????????? ? ???????? ??????? ??? ????????? ... – PowerPoint PPT presentation

Number of Views:57
Avg rating:3.0/5.0
Slides: 21
Provided by: CNs9
Category:
Tags: chick | perl

less

Transcript and Presenter's Notes

Title: Perl


1
???????? ????? ? Perl
  • ???????
  • ?????? ?????? gpenkov_at_phreedom.org ?????
    ??????? mmarinov_at_phreedom.org ?????
    ?????? roam_at_ringlet.net
  • ??? ????????
  • http//perl.phreedom.org

2
??????????
  • ????? ????????????? ??????????
  • ?????????? ?? ?????????
  • ?????
  • ???????? ??? ?????
  • ???????? ??????? ?? ?????
  • ?????????? ?????????
  • ??????? ? ????????

3
????? ????????????? ??????????
  • ????? ? ???????? ??????
  • ???-??????? ??? ? Perl ????? ??? ???????? ???
    (a.k.a. string)
  • ?????????? ????? ?? ????? ? ???????? ??????????
  • ?????????? ??????????, ????? ?? ????? ??? ?????
    ???????? ?????????? (references)
  • ??????? ??
  • string Some kind a string
  • number 2
  • el_string Other kind a string\n

4
?????????? ?? ?????????
  • ????????? ?? ?????????? ? ????????? ????????
  • ?????????? ???????? ???? ??? ??????????? ??????
    ????????? ???????
  • ?????????? ????????? ????????? ????????????? ??
    ???????
  • ?????????? ? ? ???????? ?? Doing What You Expect

5
?????
  • ??????? ?? ?????????? ???????? ? ???? ??????
    double-precision floating-point values.
  • ???? ?????scalar_variable 1234print
    scalar_variable, "\n"
  • ?????? ?????scalar_variable 1234.56
  • 12 ?? 10 ?? ????? 24-?? ??????scalar_variable
    -12e-24
  • ??????? ???? ?????scalar_variable 0377
  • ?????????????? ???? ?????scalar_variable
    -0xffprint scalar_variable, "\n"
  • ??????!scalar_variable 0xff.3

6
???????? ??? ?????
  • Perl ???????? ?????????? ???????? ?? ??????????
    ??? ?????, ??????? ?? ????? ????? ?????
  • 23
  • 5.1 2.4 ????? ? ??????
  • 3 12
  • 10 / 3 ?????? ? ??????? ???????
  • 3 2 9

7
???????? ??????? ?? ?????
  • hex ??????????? 16-??? ? 10-??? ?????
  • hex "0xFF ????? 255
  • hex a ????? 10
  • oct ??????????? 8-???, 16-??? ? 2-???? ????? ?
    10-???
  • oct 0b0010 2
  • oct 0017 15
  • oct 10 8
  • int ????? ???? ???? ?? ?????

8
?????????
  • ??????????? ?? ???????? ???????
  • ????? ?? ? ???????? ??????????, ?.?. ???? ??
    ??????? ???? ???????
  • ????? ??????????? ?? ???????, ????? ??????? ? ??
    ????????? ????????? ?? ??????????? ??????
  • ??????????? ?? ?? null-???????????, ???? ? C

9
?????????
  • ??????????? ?? ????????? ?? ???????? ??????,
    ????? ??? ???????? ?? ??????? ????????
  • Single-quoted strings
  • ?????????? ? ????????? ??????? ?? ?? ????????????
  • ?????????? ?????? \\ ? \
  • string Perl Rulessingle_quoted
    'string'print single_quoted .
    "\n"single_quoted q string print
    single_quoted . "\n"

10
?????????
  • Double-quoted strings
  • ?????????? (???. ??????) ? ????????? ??????? ??
    ????????????
  • double_quoted "single_quotedi oshte
    neshto"print double_quoted .
    "\n"double_quoted "joro\60
    single_quoted\n"print double_quoted
    double_quoted "joro\x30\n"print
    double_quoted double_quoted qq
    single_quotedprint double_quoted

11
?????????
  • ???????????? ?? ????? ????????? ?? ???????????
    ???? HERE-TO ?????????
  • !/usr/bin/perla_string 'chixen'
    ???????????? ?? ????????????print
    ltltHEREa_string larodi larodi larodi and
    chixen for freeHERE

12
????????? ? ???????? ??????? ??? ?????????
  • ???????????? (????????? ?? ?????????) ????????
    .
  • string Perltest string . rulez! .
    \n
  • ????????????? ????????
  • !/usr/bin/perla " larodi "print "triple
    chick bonus ".(a x 3)

13
????????? ? ???????? ??????? ??? ?????????
  • substr ????? ???? ?? ??????
  • !/usr/bin/perlmyString "larodi
    string"print "\n".substr(myString, 0,
    4)print "\n".substr(myString, 4, 2)print
    "\n".myString
  • length ????? ????????? ?? ??????
  • print length larodi
  • reverse ? ???????? ???????? ?????? ??????
  • s reverse larodi print s
  • print reverse larodi

14
????????? ? ???????? ??????? ??? ?????????
  • ??????? ?? ?????????? ?? ???????? ???????
  • !/usr/bin/perla " let's chom(p) these
    munchie muncheezz     \n"print achomp a
    print "chomp 1 a lt \n"chomp a print "chomp
    2 a lt \n"chop  a print "chop  1 a lt
    \n"chop  a print "chop  2 a lt \n"
    ??????! ????????? ????? ????????? ??????,
    ????? ? ?????? ?? ?????? ?a chop a print
    "chop  3 a lt \n"

15
????????? ? ???????? ??????? ??? ?????????
  • ??????? ?? ???????? ??? ??????/????? ????? lc
    (lowercase), uc (uppercase)
  • ?? ???????? ??????? ?? ??????????? ?? ?????? (???
    Windows ???????? ?? ?????? Local Settings, ?????
    ? ?????????? ????? ???? ?? locale)
  • !/usr/bin/perlprint See print lc(Me
    )print uc(Fly!\n)

16
???????? ?? ?????????
  • ??????????? ?? ????????? ?? ????? ? ????????? ??
    ????????!

17
??????? ?? ????????????? ?? ????????? ? ?????
  • ????????? ??? ??????? ?????? ???????? (???
    ???????? ?? ????????? , - ? ?.?.)
  • ????????? ?? ?????? ????????? ? ??????????
    ????????? ?????
  • ????????? ?? ???? 10-??? ?????
  • ??? ???? ???????????? ??????? ?? ? ??????? 10-???
    ????? ?? ????? ?? 0
  • " 123.45fred" ?? ??????????? ?? 123.45

18
?????????? ? ????????? ?? ????????????
  • ? Perl ????? ?????? ???????? ??????? ????
    ????????? ?? ???????????? _
  • !/usr/bin/perl_ "10a"printprint
    "\n"print "\n".hex()print "\n".int."
    ".ucprint "\n".reverse()

19
?????????? ?????????
  • perldoc (http//www.perldoc.com)
  • perldata
  • perlop
  • perlsyn
  • Learning Perl, 3rd edition

20
??????? ? ????????
  • ????? ?? ???????? ???-???!???? ?? ?????? ?
Write a Comment
User Comments (0)
About PowerShow.com