Charlotte Hee wrote:
> 
> On Thu, 11 Mar 2004, John W. Krahn wrote:
> >
> > Charlotte Hee wrote:
> > >
> > > I tried the following but it doesn't work and gives an error.
> > >
> > >  $byname { $record->{"Jason"}->PHONE } = '999-9999'; # error undefined val
> > >
> > > I keep looking at the syntax but it's not sinking in.
> >
> > Or to access it via the %byname hash:
> >
> > $byname{ Jason }{ PHONE } = '999-9999';
> 
> For a single record I can see how that works but let's say I have
> 4 or 5 employees and I have the employee information for each one
> (assumed). Now I want to build a record for each employee in a loop like
> this:
> 
>   @names = ('Jason','Aria','Samir','Owen');
> 
>   foreach $na ( @names ) {
> 
>     $record = {
>       NAME   => $na,
>       EMPNO  => $emp_no,
>       TITLE  => $title,
>       AGE    => $age,
>       SALARY => $salary,
>       PALS   => [ $friend_list ],
>     };
> 
> # store record
>  $byname{ $record->{NAME} } = $record;
>  }
> 
> Now I want to add something later, after the record for the employee has
> been created. For example, I want to add the phone for Owen.
> When I try the following I get "can't use undefined value...".
> 
>  $byname{ Owen }{ PHONE } = '999-9999';

I'm sorry but you haven't provided enough context to diagnose the
problem and you left out the rest of the error message.  The line you
provided has three defined strings so that can't be the problem.


John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to