Copyright © tutorialspoint.com
chomp VARIABLE
chomp( LIST )
chomp
Removes the last character from EXPR, each element of LIST, or $_ if no value is specified.
The character removed from EXPR
In list context, The character removed from the last element of LIST
#!/usr/bin/perl $string1 = "This is test"; $retval = chop( $string1 ); print " Choped String is : $string1\n"; print " Character removed : $retval\n";
This will produce following result
Choped String is : This is tes Number of characters removed : t