in reply to Re: Re: Working of split
in thread Working of split

well, for me, it returned the correct number:

1 'name

'

3 'name

'

3 'name val val

'

This is what I had the data file: name

name

name val val

firt one is just the name

second one is name and two tabs

third line also has two tabs

Here is your code with while loop

#!/usr/bin/perl # # testing split # use warnings; use strict; while (<>) { my @a=split (/\t/,$_); my $val=scalar (@a); print "$val '@a'\n"; }