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)
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)
I have a script with dynamic hash of hashes , and I want to print the entire hash (with all other hashes).
Itried to do it recursively by checking if the current key is a hash and if yes call the current function again with refference to the sub hash.
Most of the printing seems to be OK but in... (1 Reply)
Petal::Hash::Test(3pm) User Contributed Perl Documentation Petal::Hash::Test(3pm)NAME
Petal::Hash::Test - Test and Tutorial Petal modifier
SUMMARY
Petal modifiers are snippets of code which are used to extend the expression engine capabilities. This test shows how to write your own
modifiers.
API
The modifier API is very, very simple. It consists of two elements:
The package name
Your modifier should be called Petal::Hash::<SomeThing>, where <SomeThing> is the name that you want to give to your modifier.
For example, this modifier is called Petal::Hash::Test. Petal will automatically pick it the module up and assign it the 'test:' prefix.
package Petal::Hash::Test;
use warnings;
use strict;
The method $class->process ($hash, $argument);
This class method will define the modifier in itself.
* $class is the package name of your modifier (which might come in handy if you're subclassing a modifier),
* $hash is the execution context, i.e. the objects and data which will 'fill' your template,
* $argument is whatever was after your modifier's prefix. For example, for the expression 'test:foo bar', $argument would be 'foo bar'.
In this test / tutorial we're going to write a modifier which uppercases a Petal expression.
sub process
{
my $class = shift;
my $hash = shift;
my $argument = shift;
return uc ($hash->get ($argument));
}
1;
__END__
And that's it! Simple!
AUTHOR
Jean-Michel Hiver
This module is redistributed under the same license as Perl itself.
SEE ALSO
The template hash module:
Petal::Hash
perl v5.12.4 2011-08-25 Petal::Hash::Test(3pm)