[Petal] Accessing variable hash elements

Simon McCaughey simonmcc at nortelnetworks.com
Fri Apr 29 13:38:34 BST 2005


Ok, I know this must be a stupid question, I probably just need more caffeine but.....

I need to access a variable hash element $user{$group}

if I have a Hash as : 
my %user = ( name => 'Simon', group1 => '1', group3 => '1') ;

and an array like :
my @groups = (qw/group1 group2 group3/ );

and I want to do:

<td tal:repeat="group groups">
    <span tal:content="user group">is the user in the group</span>
</td>

I know this last bit is incorrect, but there must be a simple way of accessing $user{$group}

Thanks

Simon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.webarch.co.uk/pipermail/petal/attachments/20050429/6ff1eb3e/attachment.htm


More information about the Petal mailing list