in reply to Reference to a single array item in an array of hashes?

Why use the extra variable?

for my $i (0 .. $numTimes) { $jobTimes[$i] = { start => param("JobStart$i"), stop => param("JobStop$i"), }; }

Cheers,
Ovid

New address of my CGI Course.

Replies are listed 'Best First'.
Re: Re: Reference to a single array item in an array of hashes?
by ogxela (Novice) on Apr 05, 2004 at 22:49 UTC
    Because then I end up with really ugly stuff like this:
    $jobTimes[$i]{'startX'} = int(($jobTimes[$i]{'start'} - $dayStart) * $ +scaleConst);
    When I would much rather have:
    $$job{'startX'} = int(($$job{'start'} - $dayStart) * $scaleConst);