Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^2: How do I combine SPLIT with trimming white space

by codeacrobat (Chaplain)
on Aug 11, 2009 at 20:36 UTC ( #787760=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    foreach my $entry ( split( /;/, $file_data ) ) {
        s/^\s+//, s/\s+$// for $entry;
        push @email_list, $entry;
    }
    print join( "\n", sort(@email_list)), "\n";
    
  2. or download this
    use List::MoreUtils qw(apply);
    foreach my $entry ( split( /;/, $file_data ) ) {
        push @email_list, apply { s/^\s+//; s/\s+$// } $entry;
    }
    print join( "\n", sort(@email_list)), "\n";
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2022-09-29 11:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer my indexes to start at:




    Results (125 votes). Check out past polls.

    Notices?