Hi Paul,

In article <[EMAIL PROTECTED]>, Paul 
Johnson wrote:
[...]
> I presume this is code that you have just made up on the spot rather than
> something taken from a working project, but I couldn't say for sure what
> the Classes hash was doing.  Here's how I would code something similar for
> myself or on a team of experienced Perl programmers.  I don't expect
> everyone to agree with everything.  In particular, I expect most people
> would be happier with an explicit return statement.
> 
> sub get_class_types
> {
>     my $self = shift;
> 
>     my $roots      = [];
>     my $unresolved = [];
> 
>     while (my ($class, $props) = each %{$self->{classes}})
>     {
>         push @{$props->{parent} ? $unresolved : $roots}, $class;
>     }
> 
>     ($roots, $unresolved)
> }
> 

Why "my $roots = [];" and not "my $roots = '';" (for example)? Is it just 
style or is there is some devious/useful intent here?

-K
-- 
Kevin Pfeiffer
International University Bremen

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to