Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: How to call a function on each item after a split?

by kcott (Abbot)
on Oct 09, 2012 at 09:02 UTC ( #997957=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    /\A\s*(.*?)\s*\z/
    
  2. or download this
    say for map { (/\A\s*(.*?)\s*\z/) } split /\|/, $str;
    
  3. or download this
    say for map { clean($_) } split /\|/, $str;
    sub clean { ($_[0] =~ /\A\s*(.*?)\s*\z/)[0] }
    
  4. or download this
    $ perl -Mstrict -Mwarnings -E '
    my $str = " \t item0 with leading whitespace |item1  | item2| item3 
    ...
    <item4>
    <>
    <itemN with trailing whitespace>
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (8)
As of 2014-11-25 22:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (160 votes), past polls