develooper Front page | perl.beginners | Postings from September 2009

Re: hash of hashes question

Thread Previous | Thread Next
From:
Patrick Dupre
Date:
September 4, 2009 12:04
Subject:
Re: hash of hashes question
Message ID:
Pine.SOC.4.63.0909042004130.17418@unix0.york.ac.uk
On Fri, 4 Sep 2009, Noah Garrett Wallach wrote:

>
>
> Hi there,
>
> I am having some trouble understanding hash of hashes here.   I want to find 
> all the keys for %policy{'policy_statement'}
>
>    for my $line (@lines) {
>        for my $key ( keys %policy{'policy_statement'} ) {
Check if $keys is correct first

>            if ($line =~ 
> /set\sprotocols\sbgp\sgroup\s(\S+)\s(import|export).*?$key\s/) {
>                $policy{'policy_statement'}{$key} = 2;
>                $policy{'policy_statement'}{$key}{'group_name'}{$1} = 1;
>                $policy{'policy_statement'}{$key}{'policy_type'}{$2} = 1;
>
> perl is returning a systax error:
>
> syntax error at ./policy.sanitizer line 157, near "%policy{"
> syntax error at ./policy.sanitizer line 160, near "} ="
> syntax error at ./policy.sanitizer line 165, near "}"
> Execution of ./policy.sanitizer aborted due to compilation errors.
>
>
>
> what am I doing wrong?
>
> Cheers,
>
> Noah
>
>

-- 
---
==========================================================================
  Patrick DUPRÉ                      |   |
  Department of Chemistry            |   |    Phone: (44)-(0)-1904-434384
  The University of York             |   |    Fax:   (44)-(0)-1904-432516
  Heslington                         |   |
  York YO10 5DD  United Kingdom      |   |    email: pd520@york.ac.uk
==========================================================================
Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About