On Mon, 11 Sep 2000, John Porter wrote:

> Dave Storrs wrote:
> > 
> >     init_vars \{name => 'NONE'};
> >     my @employees : size 50;  # 50 entries, each a ref to 1 elem. hash
> >     @employees = get_from_db('*');
> >     for (@employees) {
> >             if ( $_{name} eq 'NONE' ) {
> >                     die "Oops!  DB error\n";
> >             }
> >     }
> 
> I still don't see any compelling benefit for new syntax here.
> Old syntax works great.
>  
>       my @employees = map { { name => 'NONE' } } 1..50;


        Ok, this is a fine complaint.  Which is why I started this thread
with the question "Would it be useful if...."


 
> By the way, regardless of how @employees gets initialized above,
> that initialization gets blown away by the next thing you do:
> 
> >     @employees = get_from_db('*');  # only got 2 records???
> 
> Unfortunately, your approach in this particular case is flawed.


        *Sigh*  This, unfortunately, shows that you completely missed my
point. The point of the exercise was to set up some variables (the entries
in the array), initialize them with sentienl values (i.e., values that are
known to be invalid), fill them with information from a DB, and then check
to make sure that you actually got valid info into each variable.  As
regards the imaginary function "get_from_db('*')"...I expected it to be
understood that that meant "get all records from the DB."


                                Dave

Reply via email to