in reply to remove first and last character of string
use strict; use warnings; my $str = q{"654321_1111"}; $str =~ s/^"|"$//g; print "'$str'\n";
Prints:
'654321_1111'
Note that the single quotes are added in the print to demonstrate that there are no "hidden" characters like spaces or line breaks included in the string.
Update: fix $str quoting issue pointed out by LanX.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: remove first and last character of string
by LanX (Saint) on Oct 14, 2020 at 09:51 UTC | |
by GrandFather (Saint) on Oct 14, 2020 at 10:05 UTC |