<?xml version="1.0" encoding="windows-1252"?>
<node id="251761" title="Re: parse problem" created="2003-04-19 22:05:54" updated="2005-06-21 16:08:24">
<type id="11">
note</type>
<author id="8307">
DrManhattan</author>
<data>
<field name="doctext">
The first argument to split() needs to be a regular expression matching the string that delimits the fields in your data.  In your case, the fields in your line are separated by a '|', so the code could look like this:
&lt;code&gt;
#!/usr/bin/perl

use strict;

my $data = 'gi|12345678|ref|NP_001234.1|';
my @data = split /\|/, $data;
my $number = $data[1];
&lt;/code&gt;
Or more concisely:
&lt;code&gt;
#!/usr/bin/perl

use strict;

my $data = 'gi|12345678|ref|NP_001234.1|';
my $number = (split(/\|/, $data))[1];
&lt;/code&gt;
&lt;p&gt;-Matt&lt;/p&gt;</field>
<field name="root_node">
251753</field>
<field name="parent_node">
251753</field>
</data>
</node>
