<?xml version="1.0" encoding="windows-1252"?>
<node id="997843" title="Re: How to call a function on each item after a split?" created="2012-10-08 11:55:15" updated="2012-10-08 11:55:15">
<type id="11">
note</type>
<author id="922586">
Lotus1</author>
<data>
<field name="doctext">
&lt;p&gt;The split function can get rid of the white space also.&lt;/p&gt;
&lt;c&gt;
#!/usr/bin/perl
use strict;
use warnings;

my $str = "item1  | item2| item3 
|item4|
 ";

print "&gt;$_&lt;\n" foreach split /\s*\|\s*/, $str;
&lt;/c&gt;</field>
<field name="root_node">
997827</field>
<field name="parent_node">
997827</field>
</data>
</node>
