Re: @{$var1{$var2}}

2011-06-23 Thread Dr.Ruud
On 2011-06-22 18:44, josanabr wrote: I'm reading a program written in perl and I read this statement @{ $var1{ $var2 } } Such variable names with numbers in them are often a sign of bad code. What is the context? -- Ruud -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For

Re: matplotlib

2011-06-23 Thread Sayth Renshaw
On Thu, Jun 23, 2011 at 6:32 AM, Bryan R Harris bryan_r_har...@raytheon.com wrote: I much prefer perl to python given my recent forays into that language (python's regex is awful!), however it has an excellent plotting package that is very similar to matlab but supports things like marker

sort hash

2011-06-23 Thread Irfan Sayed
Hi, i need to sort hash in descending order. but the issue is , in hash, i have key as integer value and the value associated with that key is string so when i do sort it does not really sort the hash on the key level i used follwoing code foreach my $key (sort { $hash_fin{$b} =

Re: sort hash

2011-06-23 Thread Rob Dixon
On 23/06/2011 10:36, Irfan Sayed wrote: Hi, i need to sort hash in descending order. but the issue is , in hash, i have key as integer value and the value associated with that key is string so when i do sort it does not really sort the hash on the key level i used follwoing code

Re: sort hash

2011-06-23 Thread Dr.Ruud
On 2011-06-23 11:36, Irfan Sayed wrote: [I need to sort a hash, but my keys are integers] Realize that all hash keys are strings. sort { $hash_fin{$b} = $hash_fin{$a} } keys %hash_fin You were almost there: sort { $b = $a } keys %hash_fin The = operator is numeric, so casts its

Re: @{$var1{$var2}}

2011-06-23 Thread C.DeRykus
On Jun 22, 12:49 pm, rco...@gmail.com (Rob Coops) wrote: On Wed, Jun 22, 2011 at 6:44 PM, josanabr john.sanab...@gmail.com wrote: ... Lets dissect this a little: Lets take the inner most thing ($var2) this is obviously a scalar (or a reference to another variable (I'll explain why I am

Re: sort hash

2011-06-23 Thread Irfan Sayed
thanks rob. it worked From: Rob Dixon rob.di...@gmx.com To: beginners@perl.org Cc: Irfan Sayed irfan_sayed2...@yahoo.com Sent: Thursday, June 23, 2011 3:37 PM Subject: Re: sort hash On 23/06/2011 10:36, Irfan Sayed wrote: Hi, i need to sort hash in