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