use Text::Parsewords; my $delim = ","; while (<>) { my @rec = &parse_line( $delim, 0, $_ ); # then do something with @rec... }