Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

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

by Lotus1 (Curate)
on Oct 08, 2012 at 15:55 UTC ( #997843=note: print w/replies, xml ) Need Help??


in reply to How to call a function on each item after a split?

The split function can get rid of the white space also.

#!/usr/bin/perl use strict; use warnings; my $str = "item1 | item2| item3 |item4| "; print ">$_<\n" foreach split /\s*\|\s*/, $str;

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://997843]
help
Chatterbox?
[marioroy]: The issue on the Windows platform is many workers loading "required" modules simultaneously, more so with XS modules.
[marioroy]: ... at runtime.
[marioroy]: The other problem is if a module isn't thread or multi-process safe, there's no posix_exit equivalent on the Windows platform without exiting the entire script.
[Discipulus]: and the workaround you proposed works better? ie load them once and then copy them for threads?
[Discipulus]: ah this is another interesting point: how to know if a module is or is not thread safe?
[Discipulus]: .. sorry mario if i'm bothering you at 5:46
[choroba]: Some modules mention their thread safety in the documentation
[choroba]: if they don't, it's safer to asume they aren't safe
[Discipulus]: maybe one day i'll ask is sopw: like a 9 prove for thread safety will be good

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (8)
As of 2017-09-22 09:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    During the recent solar eclipse, I:









    Results (260 votes). Check out past polls.

    Notices?