Hi ,

Yes dumper helped up to some extent. My HASH is some thing like below,
---------------
extract is HASH(0x4039ca60)
$VAR1 = {
          'Cluster' => '26'
        };
----------------

But I want it to be  like below. How to add two keys and two values to
hash.

--------------
extract is HASH(0x4039ca60)
$VAR1 = {
          'Cluster' => '26'
           'Version' => '3.1'
        };
---------------------

File from which hash is prepared contains
-----------------------
( Saturday ""
        ( Cluster "26" , Version "3.1" )
        ( Cluster "991041" , Version "4.0" )
)
---------------------

thanks

Arjun

Deserve before you desire







-----Original Message-----
From: Jeff 'japhy' Pinyan [mailto:[EMAIL PROTECTED]
Sent: Friday, July 15, 2005 9:22 PM
To: Mallik Arjun (WT01 - TELECOM SOLUTIONS)
Cc: beginners@perl.org
Subject: Re: query about hash


On Jul 15, [EMAIL PROTECTED] said:

> foreach $cluster ( @{$schedules->{$DAY->[friday]}->{STRUCT}} )
>
> from $cluster i have to extract cluster number and version. How can i
> do that ??
>
> Output is like below.
> -----------------
> extract is HASH(0x4033d910)  << From this 2 values are to be retrived
.
> upload cluster     version is clver
> ----------------

Well, *we* don't know what $cluster looks like, but *you* can.  By
printing it, you've been told by Perl that it's a hash reference.
Therefore, you can see what it looks like by doing:

   for my $ckey (keys %$cluster) {
     print "$ckey => $cluster->{$ckey}\n";
   }

Or you could even just do:

   use Data::Dumper;
   print Dumper($cluster);

--
Jeff "japhy" Pinyan         %  How can we ever be the sold short or
RPI Acacia Brother #734     %  the cheated, we who for every service
http://japhy.perlmonk.org/  %  have long ago been overpaid?
http://www.perlmonks.org/   %    -- Meister Eckhart



Confidentiality Notice

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 confidential or 
privileged information. If
you are not the intended recipient, please notify the sender at Wipro or [EMAIL 
PROTECTED] immediately
and destroy all copies of this message and any attachments.

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to