Jun 202010
Remove the last character of a string in Perl
Answer:
If you want to remove the last character of a string in Perl, e.g.
abc => ab
You can use the chop() function.
my $string = 'abc';
chop($string);
print $string; # give ab
Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.
Remove the last character of a string in Perl
Answer:
If you want to remove the last character of a string in Perl, e.g.
abc => ab
You can use the chop() function.
my $string = 'abc';
chop($string);
print $string; # give ab