I understand how to use a foreach on a reference to an array as follows:
my $avg_resp_time = get_avg_resp_time($durations, $url_id);
foreach my $avg_resp(@$avg_resp_time) {
print "AVG = $avg_resp\n";
}
But how do I directly access one array value from the reference to the
array?
print "DEBUG TEST @$avg_resp_time[0]\n"; Fails
print "DEBUG TEST @$avg_resp_time->[0]\n"; Fails
print "DEBUG TEST @{$avg_resp_time[0]}\n"; Fails
I have bookmarked ch04_07.htm of the Perl CD "Data Structure Code Examples"
but I just don't understand it.
I am trying to setup a hash for use in HTML::Template as follows
my $email_vars = { chk_freq => $chk_freq,
url_timeout => $url_timeout,
url => $url,
url_protocol => $url_protocol,
mc_email => $mc_email,
full_detail => $full_detail,
avg_resp_time => [ qw(@$avg_resp_time[0]
@$avg_resp_time[1]
@$avg_resp_time[2]
@$avg_resp_time[3]
@$avg_resp_time[4]
@$avg_resp_time[5]
@$avg_resp_time[6]) ],
sum_errors => $sum_errors,
pct_up_time => $pct_up_time,
}
Thanks
zack
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]