if I want column 1 entries to go in one array , second column entry to another and so on . How can i define my array
The easiest solution is to have an array or arrays, AoA for short. These are 2D arrays. See:
To understand AoA's you'll need to learn about references:
You can then store each field in $AoA[row number][column number]
It's unlikely you'll need to ask the user how many columns there are.
Update: doh! Cross posted with marto and hippo
, though luckily I think together our posts explain different levels and aspects of the solution.
Text::CSV is definitely the way to go!
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
Outside of code tags, you may need to use entities for some characters:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||