>> Read No. 159 article  
초가 32 ☞ 초보용 Perl 스크립트 3

등록 1999-07-09 07:21:00     조회 5
이름 쉬이이    

		오늘을 좋은날 !!!열심히...4. 연산자와 식   연산자는 Perl 변수를 결합,비교하는데 되는데
, 일반적인 수학연산자는  + ,-,*,/등이 있다. 문자를 결합해서 출력하거나 합치기,숫자의 
연산, 비교등을 할 수 있다. ☞ 간단한 예[alex99@redbird perl]$ vi count#!/usr/bin/perl $num = 0;$string =
 "shee is a good man ?? 진짜루"; while (1){  $num += 1;                  #  $num++; 와 같이 쓰인다.
  $num *= 1;  # 간단한 필요없는 테스트... 되는 구만..               # 당연한 거지만..  $nu
m /= 1;  $num -= 1;                  # $num--;  $num += 1;        if($num == 20){print  "Never ending sh
ee! "; exit(0);}  print "$num $string"; }                     [alex99@redbird perl]$ chmod +x count[alex99@r
edbird perl]$ ./count1 shee is a good man ?? 진짜루        생략 ......16 shee is a good man ?? 진짜루17 shee
 is a good man ?? 진짜루18 shee is a good man ?? 진짜루19 shee is a good man ?? 진짜루Never ending shee!   참
고 : == 는 단지 숫자를 비교할 때 사용한다. 문자열을 비교 할 때는 eq를 사용한다. eq는 포
트란과 비슷한 연산자이다.☞ fortran 스타일의 스트링 비교 연산자는 ne(부등), lt(보다 작다)
, gt(보다 큰), le(작거나 같은), ge(크거나 같은), 그리고 cmp 연산자를 사용 두 스트링을 비교 
할 수 있다. C와 비슷하게 리턴값은 작은 경우,동일한 경우,큰 경우 ( -1  ,  0  ,  1 ) 같은 
값이 출력된다. ☞ perl에는 C와 같은 제곱연산자가 없다. 사용되는 것은 ** 이다. ☞ 두 스트
링의 연결은 도트연산자(.)를 이용한다. ☞ 후후.. 흥미 있는 연산자가 있다.  반복 연산자(
repetition operater; x =) 가 있다. ☞ 하하.. 또 있다.  ?? 범위 연산자(range operator; ..) 가 있다. 도
트가 연속 두 개.☞간단한 예[alex99@redbird perl]$ cat gugudan#!/usr/bin/perl# 구구단  perl 스크립트.
 for($count1=2 ; $count1<10 ; $count1++){    for($count2=1 ; $count2<10 ; $count2++)     {      $result = $count
1 * $count2;      print "$count1*$count2=$result ";         #연산자의 출력은 /* 로 하면 된다.      
}    print "";}[alex99@redbird perl]$ chmod +x gugudan[alex99@redbird perl]$ ./gugudan2*1=2 2*2=4 2*3=6 2*4=8 2*5=10 2
*6=12 2*7=14 2*8=16 2*9=183*1=3 3*2=6 3*3=9 3*4=12 3*5=15 3*6=18 3*7=21 3*8=24 3*9=274*1=4 4*2=8 4*3=12 4*4=16 4*5=20 4*
6=24 4*7=28 4*8=32 4*9=365*1=5 5*2=10 5*3=15 5*4=20 5*5=25 5*6=30 5*7=35 5*8=40 5*9=456*1=6 6*2=12 6*3=18 6*4=24 6*5=30 
6*6=36 6*7=42 6*8=48 6*9=547*1=7 7*2=14 7*3=21 7*4=28 7*5=35 7*6=42 7*7=49 7*8=56 7*9=638*1=8 8*2=16 8*3=24 8*4=32 8*5=4
0 8*6=48 8*7=56 8*8=64 8*9=729*1=9 9*2=18 9*3=27 9*4=36 9*5=45 9*6=54 9*7=63 9*8=72 9*9=81-어어 리눅스에서는 정
렬이 되서 나옵니다. ^*^☞간단한 예 [alex99@redbird perl]$ cat operator#!/usr/bin/perl #제곱 연산자 
$x = 3;$y = 9;$z = $x ** $y; print "$x 의 $y 제곱은 $z"; #도트 연산자#반복 연산자 $first = "^*^";$first
 x= 26; print "$first"; $front_string = "아구.. 지금은 아침 6시당..";$middle_string = " 졸리다 졸려..";$
last_string = "힘내자 힘내... 오늘은 서울 올라간다."; print "$front_string.$middle_string.$last_string";
  $second = "^**^";$second x= 20; print "$second";  #범위 연산자 @num = (0..10);@char = ('A'..'Z'); print "@
num ";print "@char ";[alex99@redbird perl]$ chmod +x operator[alex99@redbird perl]$ ./operator3 의 9 제곱은 19683^*^
^*emoticon*emoticon*emoticon*emoticon*emoticon*emoticon*emoticon*emoticon*emoticon*emoticon*emoticon*emoticon*emoticon*emoticon*emoticon*emoticon*emoticon*emoticon*emoticon*emoticon*emoticon*emoticon*emoticon*emoticon*^ 아구.. 지금은 아침 6시당... 졸리
다 졸려...힘내자 힘내... 오늘은 서울 올라간다. ^**emoticon**emoticon**emoticon**emoticon**emoticon**emoticon**emoticon**emoticon**emoticon**emoticon**emoticon**emoticon**emoticon**
emoticon**emoticon**emoticon**emoticon**emoticon**emoticon**^0 1 2 3 4 5 6 7 8 9 10A B C D E F G H I J K L M N O P Q R S T U V W X Y Z       오늘 하
루 좋은 일만 있소서... 글구.. 안뇽..
이름
암호
  목록보기 윗글 아랫글
글쓰기
답장쓰기 수정 삭제
정규표현식 [ 상세 검색 ]
페이지로딩: [ 1.00 초 ] 작업시간: [ 0.5 초 ]

Copyleft 1999-2026 by JSBoard Open Project
Theme Designed by IDOO All right reserved
[TOP]

적수네 동네
+
| 적수네 동네
| 공부방
| 리눅스 잡지 서고
| LSN 소스
| 링크 모음
+---+
게시판
+
| 떠들어보세!
| 질문과 답변
| 새소식과 정보
| 1원짜리 팁?
| 대화방
+---+
칼럼?
+
| 세하 훔쳐보기
| Welcome2nite
| 혜진의 염장판
+---+
리눅스 상표권
+
| 반대 서명란
| 토론 게시판
+---+
GNU
+
| GNU 선언문
| GNU GPL
| GNU 미러 목록
+---+
프로젝트?
+
| 리눅스카운터
| RC5DES
| 실질헌법 제작
+---+
커널 소식
+
| 안정 버젼: 2.4.14
+---+
테마 선택
+
LSN 방송국?
+
| OFF AIR
+---+
회원
+
| 로그인
+---+
[ 적수네 동네 ] [ 리눅스 상표권 독점 반대 ] [ 한글 리눅스 문서 프로젝트 ] [ KrLine ] [ 사랑넷 ] [ Valid HTML 4.0! ] [ SlashDot ] [ Freshmeat ]
Copyleft (C) 1998-2001 Byeong-Chan Kim . License
TIME: 1791022329
System by WYZsoft, HDD by I.O.Linux, Mizi Research, Embryo, WOWLINUX, Domain by SarangNet, Network by KrLine.