05-29-2012
@balajesuri I am not sure if you understood my question. Thanks anyways.
The reason my if was not working is because, I had an extra space maybe in the output of my unix command. I used chomp , and it worked like a charm.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi
Help me with some good links of Hash with in Hash .(Multidimensional hash)..
Regards
Harikrishna (1 Reply)
Discussion started by: Harikrishna
1 Replies
2. Shell Programming and Scripting
HI
I have a hash like this
$hashname->{$filesystem}->{'fsname'}=$filesystem;
How to get the values from this multilevel hash.
Thanks in advance... :) (1 Reply)
Discussion started by: Harikrishna
1 Replies
3. Shell Programming and Scripting
hi
i have two hash achi %disk1,%disk2 with( key, value) (key1,value1)
How to store it in another hash..
Plz replyyy.
Regards
Hari (1 Reply)
Discussion started by: Harikrishna
1 Replies
4. Shell Programming and Scripting
print $hash{$value} if exists $hash{$key};
would only print my top value, and not the one I want to "match".... should i not be using if exists? how would you recommend "searching" a hash file...
thanks! (6 Replies)
Discussion started by: yesokay
6 Replies
5. Shell Programming and Scripting
Hi i am reading one file and creating Hash from the contents of it my issue is there are 3 different files in 3 different locations having same structure so for parsing these files i have one subroutine which returns hash after reading all the 3 files i need to create consolidated hash from three... (2 Replies)
Discussion started by: zedex
2 Replies
6. Shell Programming and Scripting
Can Someone explain me why even using Tie::IxHash I can not get the output data in the same order that it was inserted? See code below.
#!/usr/bin/perl
use warnings;
use Tie::IxHash;
use strict;
tie (my %programs, "Tie::IxHash");
while (my $line = <DATA>) {
chomp $line;
my(... (1 Reply)
Discussion started by: jgfcoimbra
1 Replies
7. Shell Programming and Scripting
Hi,
In Perl, is it possible to use a range of numbers with '..' as a key in a hash?
Something in like:
%hash = (
'768..1536' => '1G',
'1537..2560' => '2G'
);
That is, the range operation is evaluated, and all members of the range are... (3 Replies)
Discussion started by: dsw
3 Replies
8. Shell Programming and Scripting
Hi ,
i have the below code its working fine when i execute in unix , but its not working in windows could you pls explain me where i am going wrong.
This is the program
$data = { '1' => 'one' ,
'2' => 'two' ,
3 => 'three'
};
print "hello : $data->{'1'}... (2 Replies)
Discussion started by: ragilla
2 Replies
9. Shell Programming and Scripting
Hi,
I have an hashes of hash, where hash is dynamic, it can be n number of hash. i need to compare data_count values of all .
my %result (
$abc => {
'data_count' => '10',
'ID' => 'ABC122',
}
$def => {
'data_count' => '20',
'ID' => 'defASe',
... (1 Reply)
Discussion started by: asak
1 Replies
10. Programming
My issue is that the perl script (as I have done it so far) created empty branches when I try to check some branches on existence.
I am using multydimentional hashes: found it as the best way for information that I need to handle. Saing multidimentional I means hash of hashes ... So, I have
... (2 Replies)
Discussion started by: alex_5161
2 Replies
LEARN ABOUT DEBIAN
aptpkg::hash
AptPkg::hash(3pm) User Contributed Perl Documentation AptPkg::hash(3pm)
NAME
AptPkg::hash - a helper class for implementing tied hashes
SYNOPSIS
use AptPkg::hash;
DESCRIPTION
The AptPkg::hash class provides hash-like access for objects which have an underlying XS implementation.
Such objects need to add AptPkg::hash to @ISA, provide get, set and exists methods, and an iterator class.
AptPkg::hash
new([XS_OBJECT])
Create a object as a tied hash. The object is implemented as a hash reference blessed into the class, which in turn is tied to
AptPkg::hash.
This means that both $obj->method() and $obj->{key} valid, the latter invoking get/set (through FETCH/STORE).
The tie associates an array reference with the hash, which initially contains a reference to the hash, the XS object and an anon hash
which may be used by subclasses to store state information.
If no XS object is passed, one is created via new in the XS class. The name of that class is constructed from the class name, by
lower-casing the last component and prefixing it with an underscore (eg. AptPkg::Config becomes AptPkg::_config).
If the module contains a @KEYS array, then the private hash will be populated with those entries as keys (see the description below of
the AptPkg::hash::method class).
_self, _xs, _priv
Accessors which may be used in subclass methods to fetch the three array elements associated with the hash reference.
keys(ARGS)
In a scalar context, creates and returns a new iterator object (the class name with the suffix ::Iter appended).
The XS object, the private hash and any arguments are passed to the constructor.
In an array context, the iterator is used to generate a list of keys which are then returned.
The iterator class must implement a next method, which returns the current key and advances to the next.
AptPkg::hash::method
The AptPkg::hash::method class extends AptPkg::hash, providing a simple way to map a fixed set of keys (defined by the @KEYS array) into
method calls on either the object, or the internal XS object.
Classes inheriting from AptPkg::hash::method should provide an iterator class which inherits from AptPkg::hash::method::iter.
AUTHOR
Brendan O'Dea <bod@debian.org>
perl v5.14.2 2012-03-16 AptPkg::hash(3pm)