Movatterモバイル変換


[0]ホーム

URL:


functions /chop
(source,CPAN)
#chop VARIABLE
#chop( LIST )
#chop

Chops off the last character of a string and returns the character chopped. It is much more efficient thans/.$//s because it neither scans nor copies the string. If VARIABLE is omitted, chops$_. If VARIABLE is a hash, it chops the hash's values, but not its keys, resetting theeach iterator in the process.

You can actually chop anything that's an lvalue, including an assignment.

If you chop a list, each element is chopped. Only the value of the lastchop is returned.

Note thatchop returns the last character. To return all but the last character, usesubstr($string, 0, -1).

See alsochomp.

Perldoc Browser is maintained by Dan Book (DBOOK). Please contact him via theGitHub issue tracker oremail regarding any issues with the site itself, search, or rendering of documentation.

The Perl documentation is maintained by the Perl 5 Porters in the development of Perl. Please contact them via thePerl issue tracker, themailing list, orIRC to report any issues with the contents or format of the documentation.


[8]ページ先頭

©2009-2025 Movatter.jp