- or download this
my $string = EXPR; $string =~ s/^\s+|\s$//g;
- or download this
(my $string = EXPR) =~ s/^\s+|\s$//g;
- or download this
sub trim { my ($s) = @_; $s =~ s/^\s+|\s$//g; return $s; }
my $string = trim( EXPR );
- or download this
s/^\s+|\s$//g for my $string = EXPR;
- or download this
my ($string) = map { my $s = $_; $s =~ s/^\s+|\s$//g; $s } EXPR;
- or download this
use List::MoreUtils qw( apply );
my $string = apply { s/^\s+|\s$//g } EXPR;
- or download this
use Algorithm::Loops qw( Filter );
my $string = Filter { s/^\s+|\s$//g } EXPR;