in reply to Can anyone tell me what is the error in this script
You should also use code tags. You should also ready the very first few {paraghraphs,chapters} of any introductory perl tutorial.
However here's an 'I'm-doing-it-for-you' solution:
Note that depending on how you real data really looks like, there is a remote chance that this may not be exactly what you're looking for. Additional checks are left as an exercise to you.#!/usr/bin/perl -l my (@a1, @a2); while (<>) { my ($a1, $a2) = split or next; next unless $a1 and $a2; push @a1, $a1; push @a2, $a2; } print for "@a1", "@a2"; __END__
You may also be interested in -lan, see perlrun.
|
|---|