On Fri, Feb 03, 2006 at 12:28:21PM +0200, Brent Clark wrote: > Hi all > > I have a problem whereby my foreach will not update a variable ($list) if > the hash has only one key / value. > > Below is my Data Dumper output. > I basically need to do a foreach on > $xmlData->{'misc_links'}->{'activities_list'}->{'activity'}. > Now if I have two or more elements, then its work, but its only if I have > one, then I get nothing. > > If anyone could assist me, I would be most grateful.
I've not run any of your code, but: I suspect that turning on strict refs would give you the answer. > 'misc_links' => { > 'activities_list' => { > 'activity' => 'Witbank > Skydiving Club' > }, Seems that you are expecting 'Witbank Skydiving Club' to be an element in an array. > $list = ucfirst join( ", ", sort @{ > $xmlData->{'misc_links'}->{$linkName}->{$item} }); -- Paul Johnson - [EMAIL PROTECTED] http://www.pjcj.net -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>