in reply to Re: How to add a new column into my csv file?
in thread How to add a new column into my csv file?

Hi,

Thanks for the suggestion but may I know what's the reason behind it? Is split not efficient? Sorry, I just started to learn Perl few weeks ago.

  • Comment on Re^2: How to add a new column into my csv file?

Replies are listed 'Best First'.
Re^3: How to add a new column into my csv file?
by hippo (Archbishop) on Sep 07, 2017 at 08:37 UTC
    what's the reason behind it?

    The modules will handle any complications: embedded separation characters, quoting rules, missing columns, character encoding, EOL issues, etc. split will simply split a string into a list which is fine for trivial, well-formed in-memory CSV datasets. To go beyond such datasets would be tortuous without using Text::CSV_XS et al.

    It is the same reason why you would not be recommended to use regular expressions to parse any but the most trivial XML sets, for example.

    Update: (edited for typo)