in reply to cmd o/p- each line should be stored as each element in an Array?

reading perlintro in less than one hour can be the first step, a fistfull of minutes reading about lists and few seconds for a bunch of basic functions like split.
Add some <c> ..</c> (code tags) and serve hot with red wine.

L*
PS more effort, best answer.
PPS what o/p means?
There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.