Monday, December 24, 2012

Perl의 chop() operator

이 함수는 맨 뒤의 한글자를 제거해준다.
chop('ABCD') -> 'ABC'
The String Operators

용도는 다음에 잘 설명되어 있다.
When a file is read using the diamond operator, the newline character that ends the line is kept as part of the input string. Frequently ,you'll see the chop() function used to remove the newline. For instance, chop($inputLine = );. This statement reads a line from the input file, assigns its value to $inputLine and then removes that last character from $inputLine - which is almost guaranteed to be a newline character. If you fear that the last character is not a newline, use the chomp() function instead.
출처 : http://affy.blogspot.kr/p5be/ch09.htm

No comments:

Post a Comment