M
monte
i need to evalue hte values of a hash for a given key. I am new to perl
and I need a little help. I am doing a hash where the key is the cell
and the value is the lib but now that I got the values how to eval the
values and have them print only once in the output.
INPUT file format:
lib0 cell1
lib2 cell3
lib2 cell4
lib3 cell3
lib0 cell1
lib2 cell4
lib2 cell4
etc..
DESIRED ouput:
cell1 lib0 (lib0 should only appears once in output)
cell3 lib2 lib3 (this is an error)
cell4 lib2
MY code outputs:
cell1 lib0 lib0
cell3 lib2 lib3
cell4 lib2 lib2 lib2
my code is the following but I need help evaluating the values to check
that the current lib is the same as the previous lib and output the
name only once if it is the same lib otherwise return an error message.
can you please give a hint on how to do this values checking?
($rec{$cell}= "Cell:$cell Lib:") if (! exists($rec{$cell}));
$rec{$cell}.="$lib\t"; #this here produces my code output
foreach $cell(keys %rec)
{
print" $rec{$cell}\n";
}
and I need a little help. I am doing a hash where the key is the cell
and the value is the lib but now that I got the values how to eval the
values and have them print only once in the output.
INPUT file format:
lib0 cell1
lib2 cell3
lib2 cell4
lib3 cell3
lib0 cell1
lib2 cell4
lib2 cell4
etc..
DESIRED ouput:
cell1 lib0 (lib0 should only appears once in output)
cell3 lib2 lib3 (this is an error)
cell4 lib2
MY code outputs:
cell1 lib0 lib0
cell3 lib2 lib3
cell4 lib2 lib2 lib2
my code is the following but I need help evaluating the values to check
that the current lib is the same as the previous lib and output the
name only once if it is the same lib otherwise return an error message.
can you please give a hint on how to do this values checking?
($rec{$cell}= "Cell:$cell Lib:") if (! exists($rec{$cell}));
$rec{$cell}.="$lib\t"; #this here produces my code output
foreach $cell(keys %rec)
{
print" $rec{$cell}\n";
}