On Dec 12, 9:45 pm, [EMAIL PROTECTED] (Dr.Ruud) wrote:
> protoplasm schreef:
>
> > foreach (keys %opts_hash)
> > {
> > if ( !defined $opts_hash{$_} )
> > {
> > next;
> > }
> > elsif ( $opts_hash{$_} == 1 )
> > {
> > print "$_ = $opts_hash{$_}\n";
> > }
> > }
>
> An alternative way to write that:
>
> for (sort keys %opts_hash) {
> next unless defined $opts_hash{$_};
Or:
for (grep { defined $opts_hash{$_} } sort keys %opts_hash) {
:-)
Paul Lalli
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/