in reply to Problems removing leading whitespace
print Dumper($result); $VAR1 = [ " echo ", " ----------", ...
$result is a reference to an array of strings. You can access the actual array via @$result (perlreftut, perlref). You can simply use this to remove the leading whitespace from all the elements of $result: s/^\s+// for @$result;
Update: Also, your sub remove_leadspace is designed to return a modified list of strings, but you're not doing anything with its return value. You could do: @$result = remove_leadspace(@$result); or my @trimmed = remove_leadspace(@$result);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Problems removing leading whitespace
by Anonymous Monk on Jan 30, 2020 at 16:22 UTC | |
|
Re^2: Problems removing leading whitespace
by Anonymous Monk on Jan 30, 2020 at 12:13 UTC |