Tagged Questions
1
vote
2answers
54 views
HashLists in Perl
#!/usr/bin/perl -w
use strict;
my $string = $ARGV[0];
my @caracteresSeparados = split(//,$string);
my $temp;
my @complementoADN;
foreach my $i(@caracteresSeparados){
if($i eq 'a'){
...
0
votes
2answers
24 views
Perl Tie::IxHash - update values using a value list
I have a Tie::IxHash object that has been initialized as follows:
my $ixh = Tie::IxHash->new('a' => undef, 'b' => undef, 'c' => undef);
and later on I want to assign a list of values ...
1
vote
2answers
37 views
Perl: inserting array of arrays in into a array which is a value for a key
I have a need of inserting an array of arrays into an array.And this whole array is a value for a key in a hash.i meant hash should look like this:
"one"
[
[
1,
2,
[
[
3,
...
1
vote
2answers
62 views
perl parsing and assigning multiple values to hash key using array
I have files that I'm trying to parse and build a hash and lookup from a third file. File format :
File 1:
ID2
ID4
File 2:
x1 y1 z1 ID1
x2 y2 z2 ID2
x3 y3 z3 ID2
x4 y4 z4 ID4
File 3:
a1 b1
...
1
vote
1answer
42 views
How to deal with calling data that is parsed into a hash in perl
So I parsed the following XML code using Perl and i'm trying to call the spectrum results but i'm having difficulty since it is a hash. I keep getting the error message reference found where even ...
3
votes
3answers
45 views
Is it possible to make a iterate through a hash in perl in the order of how keys are stored?
Consider following hash :
my $hoh = {
'tag1' => {
'name' => 'Item 1',
'order' => '1',
'enabled' => '1',
},
'tag2' => {
'name' => 'Item 2',
'order' => '2',
...
0
votes
3answers
37 views
How to get size of an inner hash in nested hash in perl?
I have following hash of hash :
%tgs = (
'articles' => {
'vim' => '20 awesome articles posted',
'awk' => '9 awesome articles posted',
...
-3
votes
1answer
60 views
sorting of hashes in perl
I have an array of references to hashes:
@array=($ref1,$ref2,$ref3);
Each ref point to a hash with the same keys but different values.
I have to sort the hashes according to the values of KEY (one ...
4
votes
4answers
104 views
Create a hash in Perl
I have a beginner question:
I have an @key_table and many @values_tables.
I want to create a @table of references to hashes, so there is one table, each element points to hash with keys&values ...
0
votes
1answer
45 views
Setting variables in perl config file eval
I've got a perl script and a .config file and want to store some hashes in the config file with some variables as its value, then dynamically change them from my perl script.
Config File:
...
0
votes
1answer
42 views
How to compare the inner hash values of following HoH with those of the other list
my %main_hash = (
'hash1' => {
'key1' => '1-111',
'key2' => '1-222',
'key3' => '1-333'
},
'hash2' => {
'key1' => '2-111',
...
2
votes
3answers
48 views
How to extract key name from a hash of hash?
I have following hash of hash :
%HoH = (
flintstones => {
husband => "fred",
pal => "barney",
},
jetsons => {
husband => "george",
wife => "jane",
...
-2
votes
2answers
40 views
Perl syntax error in hash
This is the line I am using in my code which gives syntax error
...
else if (exists($framename{$presFrame}) && (($framename{$presFrame}) < = $j))
...
here framename is a hash and ...
0
votes
3answers
88 views
“Odd number of elements in hash assignment” - simple example code included, why does it happen?
Basically when I shift a hash to work with it in a subroutine I get the error: Odd number of elements in hash assignment. Am I supposed to use a hash reference instead if I wish to pass hashes to ...
0
votes
2answers
34 views
Perl - assign output of split() to hash slice - detecting length mismatch
I am converting a record of tab-separated values into a hash, as follows:
my @field_names = qw(foo bar xyzzy);
my $record = "33\t45\t78\n";
my %feqv_hash;
@feqv_hash{@field_names} = split /\t/, ...