in reply to need to consolidate two lines to one
$string = "hello"; $string =~ /^\s+|\s$/g;
Also since "hello" is a literal that contains neither leading nor trailing whitespaces, you can actually just write that as
If you have the string in a variable, you can write:$string = "hello";
($string = $source) =~ s/^\s+|\s$/g;
|
|---|