From: "Brian Ling" <[EMAIL PROTECTED]> > The following code fragment works but has a horrible feel about it, > can anyone suggest ways to improve it. > > The data structure is generated by an XML parser. > > for ( keys %{$parsed_data->{value}->{NetworkServices}->{value}} ) { > if ( > $parsed_data->{value}->{NetworkServices}->{value}->{$_}->{value}->{Int > er face}->{value}->{DeviceName}->{value} eq "modem" and > ...
What about: for ( values %{$parsed_data->{value}->{NetworkServices}->{value}} ) { if ( $_->{value}->{Inter face}->{value}->{DeviceName}->{value} eq "modem" and ... You may also want to use some temporary lexical variables and assign the values to them to shorten the code. Jenda ===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz ===== When it comes to wine, women and song, wizards are allowed to get drunk and croon as much as they like. -- Terry Pratchett in Sourcery -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]