Your line
while(my @line = <DATAIN>) slurps in the whole file. I think what you mean to write is:
open(DATAOUT, ">variable")||die"$!\n";
for(my $count=0.9; $count<=1; $count=$count+0.01)
{
open(DATAIN, "<$ARGV[0]")||die"cannot open \"ARGV[0]\":$!";
while(<DATAIN>)
{
my @line = split (/\t/);
if($line[2] >= $count)
{
print DATAOUT;
}
}
close DATAIN;
}
The while(<DATAIN>) structure reads the next line into the special variable $_, which is then split on tabs and stored in my @line = split (/\t/);. See I/O Operators and split.
If this does not meet spec, post your input file (wrapped in code tags) and expected output, so we can see what you see what you see. Read How do I post a question effectively?.
Update: Please do not change the content of posts - it makes it less likely people will notice your updates and makes it much more difficult to follow threads later. It looks like jwkrahn's post below answers your concerns.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.