I have created an array as follows
while (defined ($line = ``))
{
chomp ($line);
push @stack,($line);
}
#!/usr/bin/perl
while ($line = ) {
chomp ($line);
push @stack, $line;
}
# prints each line
foreach $line (@stack) {
print "$line\n";
}
# splits each line into items using ' ' as separator
# and prints the items
foreach $line (@stack) {
@items = split / /, $line;
foreach $item (@items) {
print $item . "\n";
}
}