:
chomp VARIABLE
chomp(LIST)
chomp This safer version of "chop" removes any trailing string that
corresponds to the current value of $/ (also known as
$INPUT_RECORD_SEPARATOR in the "English" module). It returns the
total number of characters removed from all its arguments.
적절한 사용은 단순히 장소에서 변경 될 변수 또는 목록을 제공하는 것입니다. 반환 값은 사용자가 사용하는 것으로, 인수 목록을 "chomped"한 횟수입니다. 예 :
chomp $disc;
심지어 :
chomp(my $disc = `disc`);
예를 들어, 전체 배열이나리스트, 예를 들어 씹는 수 : 물론
my @file = <$fh>; # read a whole file
my $count = chomp(@file); # counts how many lines were chomped
, 하나의 스칼라 인수를의 씹는 반환 값은 1 또는 0 일 수 있습니다.
출처
2013-02-18 11:59:53
TLP
'씹는의 $의 disc'도 1 – moadeep
@moadeep을 반환합니다 : 예, 물론 그것은 제거 된 문자의 수를 반환합니다. 그냥'chomp $ disc;'를 사용하십시오. – Toto