perldoc -f chompから:
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.
適切な使用法は、その場で変更される変数またはリストを単に提供することです。使用する戻り値は、引数リストを「チョッピング」した回数です。例えば
chomp $disc;
あるいは:
chomp(my $disc = `disc`);
たとえば、配列またはリスト全体を chomp することができます。
my @file = <$fh>; # read a whole file
my $count = chomp(@file); # counts how many lines were chomped
もちろん、スカラー引数が 1 つの場合、chomp の戻り値は 1 または 0 になります。