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.

Optimising for fewest key strokes only makes sense transmitting to Pluto or beyond

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

      Indeed, or something like that.

      Optimising for fewest key strokes only makes sense transmitting to Pluto or beyond