Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: RegEx needed

by Wonko the sane (Deacon)
on Dec 31, 2002 at 16:17 UTC ( [id://223364]=note: print w/replies, xml ) Need Help??


in reply to Efficient trimming of trailing whitespace from array elements?

Here is a way that you can get a list of all elements, without any leading OR trailing whitespace.
This is works even if the element itself has whitespace in the middle.
my @trimmed_array = map { /^\s*(.+?)\s*$/ } @array;

In place editing of the array would prob be prefered though
s/\s*$// for(@array);

Wonko

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://223364]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2024-04-23 06:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found