<span id="7ztzv"></span>
<sub id="7ztzv"></sub>

<span id="7ztzv"></span><form id="7ztzv"></form>

<span id="7ztzv"></span>

        <address id="7ztzv"></address>


            ??????? Perl5?§Ö?????/???

            ??????¨¹??
            ???????????
            ??????¡Â?§Ò??(\)??????
            ??????¨²?????
            ?‰]???????
            ??????????????
              ????????
            ??????????????
            ???????????????

            ??????¨¹??
                ???t?????????????????????î”????????§Û??????ï‚?????????Pascal??C?????????????????????????????????t?????????????????????????????????????�q????Perl?§µ?????????¨®????????????????????????????????????????????????¨¢?
                Perl5?§Ö??????????????????¨²???????¨¢????????¨²??§Ò?????????????????????????????????¦Ë?????????????????????t??????????UNIX???§Ö?????????????????????????§Ö???????
                Perl4??????????????????????§»????????íà??????????????????????????????_main{}????????????Perl5?????????????????????????
                ??????????????????????????????Perl???????????????????????????????????????????????§³?Perl????????????????????????Perl?§Ö??¦Ê¦Æ??????????????????????????????¨¢?
                ????????????¨²????????????????????????????????????¨°?????????????????????? ??Perl?§Ö?????????????
            ???????????
                ?????§µ??????????$pointer???????????$pointer???????????????????????????????????
                ?¦Ê¦Ì????????????????¨¢???????????????§Ø????????????????????????????????????????????????????î”?????????î”?????????????????????????????¨¹?????????????????????????????????????????????¨¢?
                ?????????§»???????
                ???$pointer???????????????????????@$pointer???????????§Ö????????@$pointer????????????$pointer?§Ö??????????????¨¢?????????%$pointer?????????§Ö???????????¨¢?
                ?§Ø??????????????????????????¦Ê??????????????????î”????????????????????????--C?????????????--???¨¢?Perl?????????§Õ?????????????????ÅR??????:)
                ???žL??Perl?§Õ??????????????????
            ??????¡Â?§Ò??(\)??????
                ??§Ò?????????C?????§Õ????????????&????????????????\??????????????¦Ì????¨¢????????????????????????????
                $variavle = 22;
                $pointer = \$variable;
                $ice = "jello";
                $iceprt = \$ice;
                ????$pointer??????$variable???¦Ë???????$iceptr???"jello"??????????????$variable?????????????????$pointer??????????????????????????????????$pointer??$variable???????????????§³?
                ????????????§µ????????$pointer?????$variable?????????????????????????????????$????????¡ê?
            #!/usr/bin/perl
            $value = 10;
            $pointer = \$value;
            printf "\n Pointer Address $pointer of $value \n";
            printf "\n What Pointer *($pointer) points to $$pointer\n";
                ?????????¡ê?
            Pointer Address SCALAR(0x806c520) of 10
            What Pointer *(SCALAR(0x806c520)) points to 10
                ??????§µ????????§Ö?????????????????????$pointer???????????$$pointer????$variable?????
                ????¦Ì?????????SCALAR???????????????SCALAR???????????????????????????????????????????????????
                ??????????????????????????????????????????????????????§¹??????????????????????????????¡ê?Perl????NULL???????????????????????????§Ñ????§Ö????????????????????§¹???????þŸ
            ??????¨²?????
                ????Perl??????¨¹????????????????????Perl?§Ö????????????????????????????????????????????????????????????????????????????????????????????????????????¨¢?
                ???????????????????????????¡Â?§Ò?????????????????????¡ê?
            1  #!/usr/bin/perl
            2  #
            3  # Using Array references
            4  #
            5  $pointer = \@ARGV;
            6  printf "\n Pointer Address of ARGV = $pointer\n";
            7  $i = scalar(@$pointer);
            8  printf "\n Number of arguments : $i \n";
            9  $i = 0;
            10 foreach (@$pointer) {
            11   printf "$i : $$pointer[$i++]; \n";
            12 }
                ???§ß?????¡ê?
            $ test 1 2 3 4
            Pointer Address of ARGV = ARRAY(0x806c378)
            Number of arguments : 4
            0 : 1;
            1 : 2;
            2 : 3;
            3 : 4;     ??5?§ß?????$pointer???????@ARGV????6?????ARGV??????$pointer????????????????????????C?????§Ö??????????????????7?§Ö??¨²???scalar()?????????????????¨°???????@ARGV????????????????@$pointer??????????????????ï…$pointer?????????@??????????????????????????????????10?????7?????????11???????$$pointer[$i]?§Ô?????????
                ???????????¡Â?§Ò???????????????????--?????§Û?????????????????$poniter???????????????????????????????????????????--ARRAY??SCALAR???????????????ï‚???????????????HASH??CODE???????????????????????
            #!/usr/bin/perl
            1  #
            2  # Using Associative Array references
            3  #
            4  %month = (
            5   '01', 'Jan',
            6   '02', 'Feb',
            7   '03', 'Mar',
            8   '04', 'Apr',
            9   '05', 'May',
            10  '06', 'Jun',
            11  '07', 'Jul',
            12  '08', 'Aug',
            13  '09', 'Sep',
            14  '10', 'Oct',
            15  '11', 'Nov',
            16  '12', 'Dec',
            17  );
            18
            19 $pointer = \%month;
            20
            21 printf "\n Address of hash = $pointer\n ";
            22
            23 #
            24 # The following lines would be used to print out the
            25 # contents of the associative array if %month was used.
            26 #
            27 # foreach $i (sort keys %month) {
            28 # printf "\n $i $$pointer{$i} ";
            29 # }
            30
            31 #
            32 # The reference to the associative array via $pointer
            33 #
            34 foreach $i (sort keys %$pointer) {
            35   printf "$i is $$pointer{$i} \n";
            36 }
                ?????????¡ê?
            $ mth
            Address of hash = HASH(0x806c52c)
            01 is Jan
            02 is Feb
            03 is Mar
            04 is Apr
            05 is May
            06 is Jun
            07 is Jul
            08 is Aug
            09 is Sep
            10 is Oct
            11 is Nov
            12 is Dec
                ?????????????????¡Â???????????????$$pointer{$index}???????$index???????????????????????????§Þ???????????????????????????????=>????????????????§»?????????????????
            1  #!/usr/bin/perl
            2  #
            3  # Using Array references
            4  #
            5  %weekday = (
            6    '01' => 'Mon',
            7    '02' => 'Tue',
            8    '03' => 'Wed',
            9    '04' => 'Thu',
            10   '05' => 'Fri',
            11   '06' => 'Sat',
            12   '07' => 'Sun',
            13   );
            14 $pointer = \%weekday;
            15 $i = '05';
            16 printf "\n ================== start test ================= \n";
            17 #
            18 # These next two lines should show an output
            19 #
            20   printf '$$pointer{$i} is ';
            21   printf "$$pointer{$i} \n";
            22   printf '${$pointer}{$i} is ';
            23   printf "${$pointer}{$i} \n";
            24   printf '$pointer->{$i} is ';
            25
            26   printf "$pointer->{$i}\n";
            27 #
            28 # These next two lines should not show anything 29 #
            30   printf '${$pointer{$i}} is ';
            31   printf "${$pointer{$i}} \n";
            32   printf '${$pointer->{$i}} is ';
            33   printf "${$pointer->{$i}}";
            34 printf "\n ================== end of test ================= \n";
            35
                ?????????¡ê?
            ================== start test =================
            $$pointer{$i} is Fri
            ${$pointer}{$i} is Fri
            $pointer->{$i} is Fri
            ${$pointer{$i}} is
            ${$pointer->{$i}} is
            ================== end of test =================
                ???????????????????????????????????????????????§³?????????????????????????????????Perl?§µ??§Ó????????????print?????????????¡ê???????????Perl??????????????????
            ?‰]???????
                ???@array = list;?????????????????????????????????????????¨¢??????????????????????????????
                $line = ['solid' , 'black' , ['1','2','3'] , ['4','5','6']];
                ????�Ü??????????????????????ï…????$line???????î•???????????????????????????????????????????????????????????????????????????????????????????¡ê?
            $arrayReference->[$index]     single-dimensional array
            $arrayReference->[$index1][$index2]   two-dimensional array
            $arrayReference->[$index1][$index2][$index3] three-dimensional array
                ?????????????????????????????????????????????????????????????????????????????????????§»--??????????§»????????—¨??????????????????????????Perl??????????????????§Õ??????????????????:)
                ???ï“??????????????????????????????????????????????????
                ??????????????????????????
            1  #!/usr/bin/perl
            2  #
            3  # Using Multi-dimensional Array references
            4  #
            5  $line = ['solid', 'black', ['1','2','3'] , ['4', '5', '6']];
            6  print "\$line->[0] = $line->[0] \n";
            7  print "\$line->[1] = $line->[1] \n";
            8  print "\$line->[2][0] = $line->[2][0] \n";
            9  print "\$line->[2][1] = $line->[2][1] \n";
            10 print "\$line->[2][2] = $line->[2][2] \n";
            11 print "\$line->[3][0] = $line->[3][0] \n";
            12 print "\$line->[3][1] = $line->[3][1] \n";
            13 print "\$line->[3][2] = $line->[3][2] \n";
            14 print "\n"; # The obligatory output beautifier.
                ?????????¡ê?
            $line->[0] = solid
            $line->[1] = black
            $line->[2][0] = 1
            $line->[2][1] = 2
            $line->[2][2] = 3
            $line->[3][0] = 4
            $line->[3][1] = 5
            $line->[3][2] = 6
                ????????????????????????????????????·Ú??
            1  #!/usr/bin/perl
            2  #
            3  # Using Multi-dimensional Array references again
            4  #
            5  $line = ['solid', 'black', ['1','2','3', ['4', '5', '6']]];
            6  print "\$line->[0] = $line->[0] \n";
            7  print "\$line->[1] = $line->[1] \n";
            8  print "\$line->[2][0] = $line->[2][0] \n";
            9  print "\$line->[2][1] = $line->[2][1] \n";
            10 print "\$line->[2][2] = $line->[2][2] \n";
            11 print "\$line->[2][3][0] = $line->[2][3][0] \n";
            12 print "\$line->[2][3][1] = $line->[2][3][1] \n";
            13 print "\$line->[2][3][2] = $line->[2][3][2] \n";
            14 print "\n";
                ?????????¡ê?
            $line->[0] = solid
            $line->[1] = black
            $line->[2][0] = 1
            $line->[2][1] = 2
            $line->[2][2] = 3
            $line->[2][3][0] = 4
            $line->[2][3][1] = 5
            $line->[2][3][2] = 6
                ???????????????????$line->[2][3][0]????????C?????§Ö?Array_pointer[2][3][0]???????§µ??¡À??????????????????????™n???????????????????????????????????????????¡ê?
            1 #!/usr/bin/perl
            2 #
            3 # Using Multi-dimensional Array and Hash references
            4 #
            5 %cube = (
            6 '0', ['0', '0', '0'],
            7 '1', ['0', '0', '1'],
            8 '2', ['0', '1', '0'],
            9 '3', ['0', '1', '1'],
            10 '4', ['1', '0', '0'],
            11 '5', ['1', '0', '1'],
            12 '6', ['1', '1', '0'],
            13 '7', ['1', '1', '1']
            14 );
            15 $pointer = \%cube;
            16 print "\n Da Cube \n";
            17 foreach $i (sort keys %$pointer) {
            18 $list = $$pointer{$i};
            19 $x = $list->[0];
            20 $y = $list->[1];
            21 $z = $list->[2];
            22 printf " Point $i = $x,$y,$z \n";
            23 }
                ?????????¡ê?
            Da Cube
            Point 0 = 0,0,0
            Point 1 = 0,0,1
            Point 2 = 0,1,0
            Point 3 = 0,1,1
            Point 4 = 1,0,0
            Point 5 = 1,0,1
            Point 6 = 1,1,0
            Point 7 = 1,1,1
                ???????????????????????%cube?§Ò??????????????????????????????????î•????$list?????????????????$list = $$ pointer{$i}; ??????????????$x = $list->[0]; ... ????????¡¤?????$x??$y??$z?????($x,$y,$z) = @$list;
                ??¨´??????????????$????->?????????????????????????????§¹??
                $$names[0] = "kamran";
                $names->[0] = "kamran";
                ?????????????????????§¹??
                $$lastnames{"kamran"} = "Husain";
                $lastnames->{"kamran"} = "Husain";
                Perl?§Ö???????????????§Õ?????????????????????????????????????????????????????????????????????????????????????????contours???????????????
                $contours[$x][$y][$z] = &xlate($mouseX, $mouseY);
            ??????????????
                perl??????????????C?§Ü??????????????????????¡ê?
                $pointer_to_sub = sub {... declaration of sub ...};
                ?????????????????????????????
                &$pointer_to_sub(parameters);
          1. ????????

          2.     ?????????????????????????????????????????¨¢???????????????????§µ????????????????????????????????????Perl??Closure??????????????Closure?????????????????????????????????????????§³?(Closure???OOP??¦Ï???)??????????§µ????????????????????????????????????Ùã?????????????‰^
            #!/usr/bin/perl
            sub errorMsg {
              my $lvl = shift;
              #
              # define the subroutine to run when called.
              #
              return sub {
                my $msg = shift; # Define the error type now.
                print "Err Level $lvl:$msg\n"; }; # print later.
              }
            $severe = errorMsg("Severe");
            $fatal = errorMsg("Fatal");
            $annoy = errorMsg("Annoying");

            &$severe("Divide by zero");
            &$fatal("Did you forget to use a semi-colon?");
            &$annoy("Uninitialized variable in use");
                ?????????¡ê?
            Err Level Severe:Divide by zero
            Err Level Fatal:Did you forget to use a semi-colon?
            Err Level Annoying:Uninitialized variable in use
                ?????§µ??????errorMsg???????????$lvl???????????????????errorMsg?????????$lvl???????????????????????§µ?????????my?????????¦Å??????????????????$lvl?????????errorMsg???????$lvl??????›Ô??¦Á???????????????????????§³??????????????????????y??§Ö????$msg??????�I????$lvl??????????????????????????
                ????????????????????????????Perl?????§Ü??????
            ??????????????
                ????????????????????????????????????????????î•????????????@_???????????????????@_???????????ï…?????????????????????ï…???????????@_?§µ?????????my(@a,@b)=@_; ??????????????????????????????@a????@b???????????????????????ø‰??????????????????????¨¢?????????
            #!/usr/bin/perl
            @names = (mickey, goofy, daffy );
            @phones = (5551234, 5554321, 666 );
            $i = 0;
            sub listem {
              my ($a,$b) = @_;
              foreach (@$a) {
                print "a[$i] = " . @$a[$i] . " " . "\tb[$i] = " . @$b[$i] ."\n";
                $i++;
              }
            }
            &listem(\@names, \@phones);
                ?????????¡ê?
            a[0] = mickey     b[0] = 5551234
            a[1] = goofy      b[1] = 5554321
            a[2] = daffy      b[2] = 666
            
            ???
            1???????????????????????????????????????????¨¢?
            2???????????????????????? (@variable)=@_; ????????????????????????§Ó??????§Ö?????????????§³?
            ???????????????
                ????????????????????????????????íà?????????????????????????????????????????????????????????????????????????????????????????????????§Õ?????????????????§Ú????????????¡ê?
                spitOut(\*STDIN);
                spitOut(\*LPHANDLE);
                spitOut(\*LOGHANDLE);
                ?????????spitOut????????¡ê?
            sub spitOut {
              my $fh = shift;
              print $fh "Gee Wilbur, I like this lettuce\n";
            }
                ?????????????????????\*FILEHANDLE??

            ????? ????? ??


            paper | appdir | ssv
            <span id="7ztzv"></span>
            <sub id="7ztzv"></sub>

            <span id="7ztzv"></span><form id="7ztzv"></form>

            <span id="7ztzv"></span>

                  <address id="7ztzv"></address>

                      ÑÇÖÞÅ·ÃÀÔÚÏß