in reply to Putting Hash values into an array
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, |
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Putting Hash values into an array
by flexvault (Monsignor) on Feb 28, 2014 at 08:35 UTC | |
by Athanasius (Archbishop) on Feb 28, 2014 at 08:52 UTC | |
|
Re^2: Putting Hash values into an array
by Raya4505 (Novice) on Feb 28, 2014 at 14:09 UTC | |
by Athanasius (Archbishop) on Mar 01, 2014 at 13:53 UTC | |
by Raya4505 (Novice) on Mar 04, 2014 at 13:53 UTC | |
by Raya4505 (Novice) on Mar 05, 2014 at 15:04 UTC | |
by Athanasius (Archbishop) on Mar 06, 2014 at 02:52 UTC | |
by Raya4505 (Novice) on Mar 06, 2014 at 17:13 UTC | |
|