King, Jason G writes:
> >%hash = (%hash,
> > $ordernum => {
> > date => @data[1],
> > submitby => @data[2],
> > mgmt => $mgt,
> > title => @data[5],
> > location => @data[9],
> > },
> >);
>
> Those @data[x] values above are array slices, they are better expressed
> as normal scalars: $data[1] etc. Ie. replace the @ with a $ when
> expressing single values like you are.
>
> Had you put this in your code:
>
> use warnings;
>
> To enable warnings, then Perl would have suggested that to you.
In addition to this, it seems a rather clumsy and inefficient way of
adding an entry to a hash. What the above does is dis-assemble an
existing hash into a list of key/value pairs, appends the new
key/value pair and constructs a new hash from scratch. Its simpler to
add the new entry directly, e.g.
$hash{$ordernum} = {...};
HTH
--
Brian Raven
"What is the sound of Perl? Is it not the sound of a wall that
people have stopped banging their heads against?"
-- Larry Wall in <[EMAIL PROTECTED]>
-----------------------------------------------------------------------
The information contained in this e-mail is confidential and solely
for the intended addressee(s). Unauthorised reproduction, disclosure,
modification, and/or distribution of this email may be unlawful. If you
have received this email in error, please notify the sender immediately
and delete it from your system. The views expressed in this message
do not necessarily reflect those of
LIFFE Holdings Plc or any of its subsidiary companies.
-----------------------------------------------------------------------
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs