10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello experts. I'm having problems with a snippet of code.
I was hoping to get help/advice to correct.
A file that this script parses has changed to the point where
I can no longer use a scalar, it looks as though I need to
create an array for a hash of hashes below.
The first output of... (1 Reply)
Discussion started by: timj123
1 Replies
2. 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
3. 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
4. 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
5. 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
6. Shell Programming and Scripting
Hi,
I have doubt regarding the Anonymous hash. For creating a object we are generally using Anonymous hash.
My Doubt is:
Why we are only using Anonymous hash?? Instead of Anonymous hash can we use global hash variable and take its reference for creating an object using same bless function??... (0 Replies)
Discussion started by: jatanig
0 Replies
7. Shell Programming and Scripting
This is my data
1 0
1 0
1 1
1 2
1 6
1 7
Assume that first field is key and 2nd field is value
I want to create a hash in perl, on this data. My hash should having uniq key and all values by , separated.
1,0,0,1,2,6,7
1 will be my key and rest of are should be values. (3 Replies)
Discussion started by: pritish.sas
3 Replies
8. Shell Programming and Scripting
i want to ask is it i can use hash in perl to store a page number with a list of words which is in that page and then print it out?
Example
Page 1 contains a are boy cat ............. (a list of sorted words)
how can i store it in a hash?
Thank you (3 Replies)
Discussion started by: mingming88
3 Replies
9. Shell Programming and Scripting
I have line which is read from xml doc. I want to put this line into hash(perl variable). find line below and how i want to put this in hash
<font size="10" type="int" name="ABC" >
hash key should be size, type and name with corresponding value
I doing as below:-
$line =~ s/\s*.*?\s//;... (3 Replies)
Discussion started by: aju_kup
3 Replies
10. 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
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)