in reply to Still having problems with spanish characters
sub trim { for (my $s = $_[0]) { # passed param assigned, not used s/^\s+//; # substitutions on $_ s/\s+$//; return $_; } }
instead, try something like
sub trim { my ($string) = @_; $string =~ s{ \A \s+ }{}xms; $string =~ s{ \s+ \z }{}xms; return $string; }
also also, do not invoke a function with an ampersand, i.e., &trim($string);, unless you know what this really does. use something like trim($string); or trim(" string to be trimmed "); instead.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Still having problems with spanish characters
by almut (Canon) on Sep 28, 2007 at 20:36 UTC | |
by Anonymous Monk on Sep 29, 2007 at 00:55 UTC |