Page 408 - 완) I MDP 프로젝트 작품 보고서(전체과 1학년)1.6
P. 408
정보통신기기 프로젝트
$string1="Hello World\n";
if($string1=~m/rld$/){
print"$string1 is a line or string ";
print"that ends with 'rld'\n";
줄이나 문자열의
$ }
끝과 일치시킨다.
출력:
Hello World
is a line or string that ends with 'rld'
$string1="Hello\nWorld\n";
if($string1=~m/\AH/){
print"$string1 is a string ";
print"that starts with 'H'\n";
문자열의 시작점과 }
\A 일치시킨다. (내부
줄이 아닌)
출력:
Hello
World
is a string that starts with 'H'
$string1="Hello\nWorld\n";
if($string1=~m/d\n\z/){
print"$string1 is a string ";
print"that ends with 'd\\n'\n";
문자열의 끝과 일 }
\z 치시킨다.
(내부 줄이 아닌)
출력:
Hello
World
is a string that ends with 'd\n'
$string1="Hello World\n";
if($string1=~m/[^abc]/){
print"$string1 contains a character other than ";
print"a, b, and c\n";
괄호 안의 항목을
[^...] 제외한 모든 문자 }
열과 일치시킨다.
출력:
Hello World
contains a character other than a, b, and c
정보통신기기과
- 401 -