Funny. This simple test works for me: <snip> use strict; use warnings;
my $t = &fun; print @$t[0]; # prints a sub fun { my @arr = qw(a b c d e); return \@arr; } </snip> hth Toby -----Original Message----- From: Zachary Buckholz [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 10, 2002 4:31 PM To: [EMAIL PROTECTED] Subject: help dereferencing arrayref so I can put the value into a hash 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] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]