in reply to While Loop Problem!

You never declare or initialize $line_type in your code, which looks a bit suspicious, because you check for definedness of it.
To your question: You could just push the lines onto an array within the while loop.
Example:
#!perl use strict; use warnings; my @lines; for (qw/one two three/) { push @lines, $_; print "Found *** $_ *** $/"; } print "Lines: ", join " - ", @lines;

Hope this helped,
CombatSquirrel.
Entropy is the tendency of everything going to hell.