Help for this page

Select Code to Download


  1. or download this
    sub parse_csv {
        my $text = shift;      # record containing comma-separated values
    ...
           push(@new, undef) if substr($text, -1,1) eq ',';
           return @new;      # list of values that were comma-separated
    }
    
  2. or download this
    use Text::ParseWords;
    
    sub parse_csv {
        return quotewords(",",0, $_[0]);
    }