in reply to Efficient trimming of trailing whitespace from array elements?
map {s/\s+$//; $_} @data
should do nicely. The result is a list that contains the original elements minus trailing whitespace. Note the $_: this gives you the string rather than the output of the regexp which would be just the number of substitutions.
Hope this helps, -gjb-
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: RegEx needed
by diotalevi (Canon) on Dec 31, 2002 at 16:07 UTC | |
by gjb (Vicar) on Dec 31, 2002 at 16:14 UTC |