<?xml version="1.0" encoding="windows-1252"?>
<node id="1006854" title="Split function" created="2012-12-03 06:32:28" updated="2012-12-03 06:32:28">
<type id="115">
perlquestion</type>
<author id="961">
Anonymous Monk</author>
<data>
<field name="doctext">
Hi,

i am reading a text file. and my code looks like below:
&lt;c&gt;
open FH, "$INPUT_DIR/$input_file" or die "Couldn't Open File: $!";
 
while ( &lt;FH&gt; ) {
 
chomp;
 
my ($s, $a, $c, $r) = (split / [, \t]/, $_);
&lt;/c&gt; 
the split fucntion process the comma and tab delimited now.
 
Input file:
&lt;c&gt;
process:
 
clientserver,00001,AIT,SOURCE
 clientserver        00001     AIT       SOURCE
 
error:
 
clientserve|00001|AIT|SOURCE
&lt;/c&gt;
split should die if it finds the pipe and it should process if it finds comma or tab delimited.</field>
<field name="reputation">
11</field>
</data>
</node>
