Hello Raya4505,
As you haven’t shown any sample input data, it’s difficult to guess what you are trying to do. However, I do have some observations on the code:
The code as given is incomplete. I presume it begins with:
use strict; use warnings; use Data::Dumper; # for Dumper()
The line:
open my $fh1, '>', "Output by RID.txt" or die "Cannot open output.txt: + $!";
contradicts itself. Is the output file to be named “Output by RID.txt” (with spaces) or “output.txt”?
The body of the loop beginning foreach (my $RID) will never be entered: my declares $RID as a new lexical variable, so its value is undef and the loop immediately terminates.
Having just opened the filehandle $fh1 for writing, you then immediately attempt to read from it: my @Search = <$fh1> ; This guarantees that @Search is empty.
The hashes %frequency and %counts are populated, but never used.
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
In reply to Re: Putting Hash values into an array
by Athanasius
in thread Putting Hash values into an array
by Raya4505
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |