On Thu, Jun 28, 2001 at 05:34:22PM +0100, mark crowe (JIC) wrote:
> > $compare = { split (/:/, $stats)};
> > @records = \$compare;
>
> I think you'd be better off to use:
> @records = split (/:/, $stats)
While this is correct..
> At the moment you are splitting to a scalar (which I think just puts the
> first (or is it the last?) value from that split into the scalar) and then
> assigning a reference to that scalar as an array.
this isn't. He's creating an anonymous hash with { split(/:/, $stats) },
then assigning it to $compare. He then assigns a reference to $compare to
$records[0], which makes it a reference to a hash reference.
> I'm sure that's not good for you (and I'm a bit surprised that -w didn't
> pick it up, or haven't you tried it from the command line?)
The code will only cause a warning if the split returns an odd number of
elements.
Michael
--
Administrator www.shoebox.net
Programmer, System Administrator www.gallanttech.com
--