In what decate was it good practice introducing a dependency on an external module in order to get the exact same two substitutions hidden in a sub:
#--------------------------------------------------------------------- +--------- # trim # =head1 trim(string) Returns the string with all leading and trailing whitespace removed. Trim on undef returns undef. =cut sub trim{ my ($val) = @_; if (defined $val) { $val =~ s|^\s+||s; $val =~ s|\s+$||s; }; return $val; } # # trim #--------------------------------------------------------------------- +---------
If it really bothers you just add one line to your code and be done with it.
In reply to Re^2: Pulling white space off before/after string?
by Fletch
in thread Pulling white space off before/after string?
by ecuguru
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |