06-10-2010
Thanks pludi and durden_tyler for helping to look at my issue.
I think the issue has been settled with pludi's suggestion. I will look into changing the code with hash of hash when i have time
9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
hello
I have loop , in this loop im picking names , this names I want to be keys in %hash
but I don't know how to set in every loop entertain different key in the %hash (1 Reply)
Discussion started by: umen
1 Replies
2. Shell Programming and Scripting
Say that I want to match any of the following:
abc
def
ghi
The letters will either be "abc", "def", or "ghi", only those three patterns. The numbers will vary, but there will only be numbers between the brackets.
I've only been able to match abc, using the following:
abc.*.
I'm... (1 Reply)
Discussion started by: retrovertigo
1 Replies
3. Shell Programming and Scripting
Hi, sorry, two hash related questions in one day .. but this has got me a bit stuck.
I have a mysql database table that kind of looks like this, the table is called "view1" and a snippet of that table (SELECT'ing just rows with serial number 0629AN1200) is below
serial nic_name ... (2 Replies)
Discussion started by: hcclnoodles
2 Replies
4. 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
5. 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
6. Shell Programming and Scripting
hi all,
i have a small problem regarding sorting the keys in a hash.
my %hash;
for($i=0;$i<19;$i++)
{
$hash{$i}=$i;
}
foreach $c (sort keys %hash)
{
print "\n $hash{$c}";
} (1 Reply)
Discussion started by: niteesh_!7
1 Replies
7. Programming
I am trying to store this information (info and number) in hash. number is the key and info is value in a hash.i shown my code below.
#!/usr/bin/perl
use warnings;
use strict;
use XML::LibXML::Reader;
my $file;open $file, 'formal.xml');
my $reader =... (0 Replies)
Discussion started by: veerubiji
0 Replies
8. 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
9. Shell Programming and Scripting
I need to search for lines starting with "Include" and later has string "httpd-ssl.conf"
like the regex should return match for "Include conf/extra/httpd-ssl.conf"
I tried the following:
^]*#;].+Include.*httpd-ssl.conf
Below is my current file:
# Secure (SSL/TLS) connections... (7 Replies)
Discussion started by: mohtashims
7 Replies
LEARN ABOUT REDHAT
hash::util
Hash::Util(3pm) Perl Programmers Reference Guide Hash::Util(3pm)
NAME
Hash::Util - A selection of general-utility hash subroutines
SYNOPSIS
use Hash::Util qw(lock_keys unlock_keys
lock_value unlock_value
lock_hash unlock_hash);
%hash = (foo => 42, bar => 23);
lock_keys(%hash);
lock_keys(%hash, @keyset);
unlock_keys(%hash);
lock_value (%hash, 'foo');
unlock_value(%hash, 'foo');
lock_hash (%hash);
unlock_hash(%hash);
DESCRIPTION
"Hash::Util" contains special functions for manipulating hashes that don't really warrant a keyword.
By default "Hash::Util" does not export anything.
Restricted hashes
5.8.0 introduces the ability to restrict a hash to a certain set of keys. No keys outside of this set can be added. It also introduces
the ability to lock an individual key so it cannot be deleted and the value cannot be changed.
This is intended to largely replace the deprecated pseudo-hashes.
lock_keys
unlock_keys
lock_keys(%hash);
lock_keys(%hash, @keys);
Restricts the given %hash's set of keys to @keys. If @keys is not given it restricts it to its current keyset. No more keys can be
added. delete() and exists() will still work, but will not alter the set of allowed keys. Note: the current implementation prevents the
hash from being bless()ed while it is in a locked state. Any attempt to do so will raise an exception. Of course you can still bless()
the hash before you call lock_keys() so this shouldn't be a problem.
unlock_keys(%hash);
Removes the restriction on the %hash's keyset.
lock_value
unlock_value
lock_value (%hash, $key);
unlock_value(%hash, $key);
Locks and unlocks an individual key of a hash. The value of a locked key cannot be changed.
%hash must have already been locked for this to have useful effect.
lock_hash
unlock_hash
lock_hash(%hash);
lock_hash() locks an entire hash, making all keys and values readonly. No value can be changed, no keys can be added or deleted.
unlock_hash(%hash);
unlock_hash() does the opposite of lock_hash(). All keys and values are made read/write. All values can be changed and keys can be
added and deleted.
AUTHOR
Michael G Schwern <schwern@pobox.com> on top of code by Nick Ing-Simmons and Jeffrey Friedl.
SEE ALSO
Scalar::Util, List::Util, Hash::Util
perl v5.8.0 2002-06-01 Hash::Util(3pm)