|
Downloaded Tie-IxHash
You must somehow have modified the values of VAR3
and VAR4 to change the values of the hash
the following works as expected
__start_of_code__
#!perl use warnings; use strict;
use Data::Dumper; use Tie::IxHash;
my %hash;
# Note Bienne
# quotes are needed to stop 'bare word' complaint by strict
my $t = tie %hash, 'Tie::IxHash';
# alternate method to prevent strict from complaining
# put the following within a code block
# my $t
# {
# no strict;
# $t = tie %hash, "Tie::IxHash";
# }
# however, I do not recommend it since the results are identical
%hash = ( VAR1 => 'DATA1',
VAR2 => 'DATA2', VAR3 =>
'DATA3', VAR4 => 'DATA4' ); print
Dumper(\%hash);
$hash{'VAR5'} = 'DATA5'; $hash{'VAR6'} = 'DATA6'; print
Dumper(\%hash);
print Dumper($t);
__end_of_ code__
$VAR1 = { 'VAR1'
=> 'DATA1', 'VAR2'
=> 'DATA2', 'VAR3'
=> 'DATA3', 'VAR4'
=> 'DATA4' };
$VAR1 = {
'VAR1' => 'DATA1',
'VAR2' => 'DATA2',
'VAR3' => 'DATA3',
'VAR4' => 'DATA4',
'VAR5' => 'DATA5',
'VAR6' => 'DATA6' };
$VAR1 = bless(
[
{
'VAR3' =>
'2',
'VAR6' =>
'5',
'VAR1' =>
'0',
'VAR4' =>
'3',
'VAR5' =>
'4',
'VAR2' =>
'1'
},
[
'VAR1',
'VAR2',
'VAR3',
'VAR4',
'VAR5',
'VAR6'
],
[
'DATA1',
'DATA2',
'DATA3',
'DATA4',
'DATA5',
'DATA6'
],
6
], 'Tie::IxHash' );
----- Original Message -----
Sent: Friday, June 09, 2006 12:07
AM
Subject: Re: IxHash and
Data::Dumper
----- Original Message -----
Sent: Thursday, June 08, 2006 4:32
AM
Subject: RE: IxHash and
Data::Dumper
Thanks Brain
I have this script that I
ran
use Data::Dumper; use IxHash;
print @INC;
my %hash;
tie %hash, "IxHash";
%hash = ( VAR1 =>
'DATA1', VAR2 => 'DATA2',
VAR3 => 'DATA3', VAR4 =>
'DATA4' ); print
Data::Dumper::Dumper(\%hash);
I got the following output
'VAR1'
=> 'DATA1',
'VAR2' =>
'DATA2', 'VAR3'
=>
\$VAR1->{'VAR1'},
'VAR4' => \$VAR1->{'VAR2'}
but I was expecting
'VAR1'
=> 'DATA1',
'VAR2' =>
'DATA2', 'VAR3'
=> 'DATA3',
'VAR4' => 'DATA4'
Can anyone give any suggestion to solve this issue
I dont know what IxHash is or does and
why it is necessary
Eliminating references to IxHash,
the output is as expected.
PS print
Data::Dumper::Dumper(\%hash);
can be reduced to
print
Dumper(\%hash);
best regards
Sasi Sekar
From:
[EMAIL PROTECTED] on behalf of Brian
Raven Sent: Wed 6/7/2006 6:50 PM To:
[email protected] Subject: RE: IxHash and
Data::Dumper
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
On Behalf Of [EMAIL PROTECTED] Sent: 07 June 2006 12:57 To:
[email protected] Subject: IxHash and
Data::Dumper
> Hi > I am using a hash with ordering and
hence used IxHash > It solved all my problems expect for the final
printing of the Hash > I was initially using Data::Dumper to print the
Hash > now the same outputs the first 2 elements of HASH correctly and
rest of them are not printed properly > But if I print each element
I am able to get the data right > > Any suggestion or
solution for getting the hash printed thru Dumper or any similar
output
I'm afraid that is a poor description of your problem. Just
saying "not printed properly" does not tell us a great deal. I recommend
posting a small (emphasis on small), self contained script that
demonstrates your problem. Something that we can, if we wish, cut &
paste & run ourselves.
HTH
-- Brian
Raven
================================= Atos Euronext Market
Solutions Disclaimer ================================= The information
contained in this e-mail is confidential and solely for the intended
addressee(s). Unauthorised reproduction, disclosure, modification, and/or
distribution of this email may be unlawful. If you have received this
email in error, please notify the sender immediately and delete it from your
system. The views expressed in this message do not necessarily reflect those
of Atos Euronext Market Solutions.
L'information contenue dans cet
e-mail est confidentielle et uniquement destinee a la (aux) personnes a
laquelle (auxquelle(s)) elle est adressee. Toute copie, publication ou
diffusion de cet email est interdite. Si cet e-mail vous parvient par
erreur, nous vous prions de bien vouloir prevenir l'expediteur immediatement
et d'effacer le e-mail et annexes jointes de votre systeme. Le contenu de ce
message electronique ne represente pas necessairement la position ou le
point de vue d'Atos Euronext Market
Solutions.
_______________________________________________ ActivePerl
mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
The information contained
in this electronic message and any attachments to this message are
intended for the exclusive use of the addressee(s) and may contain
proprietary, confidential or privileged information. If you are not
the intended recipient, you should not disseminate, distribute or copy
this e-mail. Please notify the sender immediately and destroy all
copies of this message and any attachments.
WARNING: Computer
viruses can be transmitted via email. The recipient should check this
email and any attachments for the presence of viruses. The company
accepts no liability for any damage caused by any virus transmitted by
this
email.
www.wipro.com
|
|