in reply to Re: How to create array from file
in thread How to create array from file

Hi Corion, I edit my question with code please suggest out to get that output.

Replies are listed 'Best First'.
Re^3: How to create array from file
by Corion (Patriarch) on Jan 20, 2017 at 12:28 UTC

    If you really, really want single-element arrayrefs, don't push the string, but push an array reference containing the string:

    while(<FH>){ chomp $_; push(@data,[$_]); }

    But really, reconsider using Text::CSV_XS instead, because soon you will want to split up that string on commas whitespace using split and then you'll find that Text::CSV_XS is much better. Also see perldsc on data structures maybe.

    Upon reading chorobas reply, I see that I completely forgot about quoting the other parts on output. Oh well.