Cari di Perl 
    Perl User Manual
Daftar Isi
(Sebelumnya) Remove a trailing record separ ...Get character this number repr ... (Berikutnya)
Functions for SCALARs or strings

Remove the last character from a string

Daftar Isi

  • chop VARIABLE

  • chop( LIST )
  • chop

    Chops off the last character of a string and returns the characterchopped. It is much more efficient than s/.$//s because it neitherscans nor copies the string. If VARIABLE is omitted, chops $_.If VARIABLE is a hash, it chops the hash's values, but not its keys.

    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 thelast chop is returned.

    Note that chop returns the last character. To return all but the lastcharacter, use substr($string, 0, -1).

    See also chomp.

 
Source : perldoc.perl.org - Official documentation for the Perl programming language
Site maintained by Jon Allen (JJ)     See the project page for more details
Documentation maintained by the Perl 5 Porters
(Sebelumnya) Remove a trailing record separ ...Get character this number repr ... (Berikutnya)