Anyway. When you print $dub_values and it shows up as an array ref as
ARRAY(0x4002c164)
and you want the values of this arrayref, you have to dereference it in some
way.
Start with printing out @$dub_values.
Or assign it before if you want bigger freedom to format the values:
my @[EMAIL PROTECTED];
# handle @dub_values_arr
Hope this helps
Dani
I don't mean to sound negative, but did you even look at my code? I know how
to dereference and I was just printing this in my debugging efforts.
dublin_aref = [EMAIL PROTECTED]
Again, @dublin_arry contains a glob like so: glob("/home/oryann9/passwd.*)
dub_values are the values within the hash %dublin_hosts while dub_key is the
regexp from the filenames that is the key within the hash %dublin_hosts.
As an example, each key is the regexp of each file name from the array
reference: passwd.dubhpr01.hpux after being parsed by my regexp I get
dubhpr01.hpux
Each values are the various fields in the passwd files.
My Goal is below
key=>dubhpr01.hpux
values=>name,uid,gid,comments
Here is the snippet of code I am working on now:
1 use strict;
2 use warning;
3 use diagnostics;
4
5 my @dublinaray = glob("/home/oryann9/passwd.*");
6 my $dublin_aref = [EMAIL PROTECTED];
7 my (%dublin_hosts) = ();
8 my ($dub_key,$dub_values,);
9
10 parse_file();
11
12
13 sub parse_file {
14 foreach my $element ( @{$dublin_aref} ) {
15 { local *FILE;
16 open (FILE, "+<$element") or die "dublin reference did not open: $!";
17 local $/ = undef;
18 ($dub_key) = $element =~ m|\.(\w+\.\w+)\z|i;
19 ($dub_values) = split /:/, <FILE>;
20 push ( @{$dublin_hosts{$dub_key}}, $dub_values );
21 print Dumper("KEY\t",$dub_key,"\n\n");
22 print Dumper("ELEMENTS\t",$element,"\n\n");
23 print Dumper("DUB VALUES\t",$dub_values,"\n\n");
24 }
25 }
26 while ( ($dub_key,$dub_values) = each %dublin_hosts ) {
27 print Dumper("$dub_key => $dub_values\n");
28 }
29
30 } ##-- END SUB --##
Here is my question
I have a line of code like so: "$dub_key => $dub_values\n";
that prints
dubhpr28.hpux => ARRAY(0x4002e1bc)
but I want to have printed out the values contained in the $dub_values
arrayref instead of its address.
What do I have to change to achieve this?
thank you
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com