in reply to Re: Re: Re: remove both leading and trailing spaces
in thread remove both leading and trailing spaces
... is if the variable has spaces contained in the phrase that you want to keep, this will get rid of them...regex2 => sub { my $tmp = $val; $val = join (" ",split " ",$val); },
regex1 and regex2 would retain the internal spaces.$var = " Smart Way "; $val = join (" ",split " ",$val); print "var: $var\n"; # $var now "Smart Way", internal spaces gone.
|
|---|