AgentM had pretty much the complete list (except
chop). Your question, however, is
not really specific enough to do more then point you at these documents. But I suspect,
rather... HOPE, that you looked at the
library before posting your question and have
therefor seen these documents (
chop,
chomp,
tr,
s) so you probably wanted an example.
Lets see:
use strict; #Always!
my $string = "This is a test string. 123\n";
chomp($string); # removes the "\n" from the end of $string.
chomp($string); # no-op. chomp only removes white-space: \t, ' ', \n,
+etc...
chop($string); # removes the '3' from the end of $string.
chop($string); # removes the '2'... get the idea?
print $string, $/; # print the string, and a new-line.
$string =~ s/a //; # replaces an appearance of 'a ' with ''
print $string, $/; # print the string, and a new-line.
# should read: "This is test string. 1"
$string =~ tr/.//d; # remove all periods.
print $string, $/;
$string =~ s/.$//; # removes the last char. slower then chop.
$string =~ s/..$//; # removes the last two characters.
my $n = 6;
$string =~ s/.{$n}$//; # removes the last $n characters.
print $string, $/;