I guess it is working now, but I might have another problem in my script, as I am not getting the expected result. My whole code is:
#!/usr/bin/perl + #network_coco.plx + use warnings; use strict; + open(DATAIN, "<$ARGV[0]")||die"cannot open \"ARGV[0]\":$!"; open(DATAOUT2, ">>cococount.txt")||die"$!\n"; + for(my $count=0.9; $count<=0.95; $count=$count+0.01) { open(DATAOUT, ">variable")||die"$!\n"; while(<DATAIN>) { my @line=split (/\t/); if($line[2] >= $count) { print DATAOUT; } } close(DATAOUT); system ("clm close -abc variable --is-undirected --write-count -cc +-bound 5 > var2"); #clm close reads file variable, and gives back an integer + open(VAR2, "<var2")||die"$!\n"; while (<VAR2>) { chomp; print DATAOUT2 "$count\t$_\n"; } close(VAR2); } + close(DATAOUT2);
What I want is a the file cococount.txt containing:
0.9 (tab) 13 0.91 (tab) 9 0.92 (tab) 7 0.93 (tab) 8 0.94 (tab) 5 0.95 (tab) 4 And what I get is: 0.9 (tab) 13 0.91 (tab) 0 0.92 (tab) 0 0.93 (tab) 0 0.94 (tab) 0
I guess the problem should be overwritting file "variable". Also, I do not get the final line : 0.95 ... Any ideas? Many thanks, Hernando

In reply to split function by herny

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.