Go Back   CodingForums.com > :: Server side development > Perl/ CGI

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-26-2010, 07:23 AM   PM User | #1
MetalGear
New Coder

 
MetalGear's Avatar
 
Join Date: Feb 2008
Location: Jambudvipa
Posts: 56
Thanks: 6
Thanked 1 Time in 1 Post
MetalGear is an unknown quantity at this point
Smile How to change hash value for a particular Key?

Hello all,

I have a query, is there any way to change value of a particular key in hash?

Code:
my %unique;
$j = 1;
$unique[$ftype[$k] = "j"
for($i=0;$i<$length;$i++)
{
if(($i+1)<$length)
        {
                if($ftype[$i] eq ($ftype[$i+1]))
                {
                        $j++;
                        $unique{$ftype[$k]} = "$j"; ##Here I am trying to assign new value
                }
                if($ftype[$i] ne ($ftype[$i+1]))
                {
                        $j = 1;
                        $unique{$ftype[$i+1]} = "$j";
                }
        }
}
based on certain conditions, I am trying to edit the hash key's value,
but it is returning 1, Which I am assigning to the key when it is created.

Please help me,
Thanks

Last edited by MetalGear; 02-26-2010 at 09:08 AM..
MetalGear is offline   Reply With Quote
Old 02-26-2010, 09:09 AM   PM User | #2
MetalGear
New Coder

 
MetalGear's Avatar
 
Join Date: Feb 2008
Location: Jambudvipa
Posts: 56
Thanks: 6
Thanked 1 Time in 1 Post
MetalGear is an unknown quantity at this point
My mistake, some variable was manipulated.
This code does work.

please delete if required
Quote:
Originally Posted by anil mundewadi View Post
Hello all,

I have a query, is there any way to change value of a particular key in hash?
MetalGear is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:51 AM.


Advertisement
Log in to turn off these ads.