Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

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

by kcott (Canon)
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
  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 
    <itemN with trailing whitespace>

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2015-11-30 00:10 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (754 votes), past polls