Page 407 - 완) I MDP 프로젝트 작품 보고서(전체과 1학년)1.6
P. 407

$string1="Hello  World\n";
                                         if($string1=~m/\S.*\S/){
                                         print"There      are  TWO  non-whitespace  characters,  which";
                                         print"    may be  separated  by  other  characters, in  $string1";
                     공백을  제외한  어
             \S      떠한 것이든 일치           }
                     시킨다.
                                         출력:
                                         There  are  TWO  non-whitespace  characters,  which  may  be
                                         separated  by  other  characters,  in  Hello  World

                                         $string1="99  bottles  of beer  on  the    wall.";
                                         if($string1=~m/(\d+)/){
                                         print"$1      is  the  first  number  in  '$string1'\n";
             \d      숫자를  일치시킨다.         }


                                         출력:
                                         99  is  the  first  number  in  '99  bottles  of  beer  on  the      wall.'

                                         $string1="Hello  World\n";
                                         if($string1=~m/\D/){
                                         print"There      is  at  least  one  character  in  $string1";
                                         print"      that  is  not  a  digit.\n";
                     숫자가  아닌  항목
             \D                          }
                     을  일치시킨다.
                                         출력:
                                         There  is  at  least  one  character  in  Hello  World
                                         that  is  not  a  digit.


                                         $string1="Hello  World\n";
                                         if($string1=~m/^He/){
                                         print"$string1      starts  with  the  characters  'He'\n";
                     줄이나       문자열의      }
             ^       시작점과  일치시킨
                     다.
                                         출력:
                                         Hello  World
                                         starts  with  the  characters  'He'















            인천전자마이스터고등학교
                                                         -  400  -
   402   403   404   405   406   407   408   409   410   411   412