--- Nick Marden <[EMAIL PROTECTED]> wrote:
> Am I missing something?
> 
> [EMAIL PROTECTED] nick] cat split_test.pl
> #!/usr/bin/perl -w
> 
> while(my $line = <>) {
>     my @F = split( ',', $line );
>     print "[EMAIL PROTECTED] has ", scalar(@F), " entries\n";
> }
> 
> [EMAIL PROTECTED] nick] perl split_test.pl
> A,B,C
> @F has 3 entries
> A,B,C,D,E,F
> @F has 6 entries
> A,B,C,D,,
> @F has 6 entries
> A,B,C,,,
> @F has 6 entries
> 


As far as I can tell, this always returns 6 b/c you're not
chomping $line. Hence the last field isn't empty, it
actually contains the newline character \n. This makes @F
always have 6 entries--

=====
Ken Gosier
[EMAIL PROTECTED]


        
                
__________________________________
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs  
http://hotjobs.sweepstakes.yahoo.com/careermakeover 
_______________________________________________
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to