Making a wild stab in the dark given the vagueness of input and output available/desired I am assuming an input file format like:
# input foo bar baz boo foo bar baz bax foo bar baz boo foo bar foo bar baz boo foo bar baz bax foo bar baz boo foo bar baz bax my $max = 40; while(<FILE>){ chomp; my @elems = split ' '; @elems = grep{ defined $_ }@elems[0..7]; $max -= scalar @elems; last if $max < 0; # exit if printing would make more than 40 elemen +ts; print "@elems\n"; last if $. == 6; # exit at 6th line (1+5 more) }
cheers
tachyon
In reply to Re: printing certain number of data
by tachyon
in thread printing certain number of data
by drock
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |