1 Replies - 2856 Views - Last Post: 22 June 2012 - 09:02 AM

#1 MartinKravec  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 5
  • Joined: 20-June 12

Is it hash or element of hash ?

Posted 22 June 2012 - 06:02 AM

Is it hash or element of hash ?

I have this hash of hashes:

Graph = (
    lines => {
        line1   => {
            init => "A1",
            term => "A5",
            type => "N2Nrev",
        },
    },
);


For example:
$node = "A5";


And i am doing conditional expression
foreach $key ( keys $graph{lines} ){
			if( ($graph{lines}{$key}{'init'} eq $node) or ($graph{lines}{$key}{'term'} eq $node) ){
				delete($graph{lines}{$key});
			}
		}


So why is this producing error "Type of arg 1 to keys must be hash ( not hash element ) on line 1 " ?

Is This A Good Question/Topic? 0
  • +

Replies To: Is it hash or element of hash ?

#2 MartinKravec  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 5
  • Joined: 20-June 12

Re: Is it hash or element of hash ?

Posted 22 June 2012 - 09:02 AM

I think i got it..

foreach $key ( keys %{$graph{lines}} ){

Was This Post Helpful? 1
  • +
  • -

Page 1 of 1