On Sat, Jun 22, 2002 at 04:42:42PM -0700, drieux wrote: > > On Saturday, June 22, 2002, at 03:09 , Marco Antonio Valenzuela Escárcega > wrote: > > >On Sat, 2002-06-22 at 13:53, Shawn wrote: > [..] > >>Is there a reason for this, and is there a way I can see what the > >>actuall values are? The values are passed just fine to the sub routines, > >> I just want my debug log to show that values passed without having to > >>set up a for loop (ie: print %$hash_ref). > >> > >>TIA, > >>Shawn > > > >probably you are trying to use the hash in scalar context, > > > >you should be able to se the values like this: > > > >print "@{ [ values %$hash_ref ] }\n"; > > way Close > > my %hash = (user => 1,pass => 2,thing => 3,ptr => [qw(4 5)],); > > my $hash_ref = \%hash; > > print split(/ /,%$hash_ref ), "\n"; > print "Not Split: ", %$hash_ref, " :\n"; > my @array = %$hash_ref; > print "Array Game: @array :\n"; > > print " Player: @{ [ %$hash_ref ] }\n"; > > generates > > 4/8
This is the number of buckets used over the number of buckets. Probably not terribly useful unless you are optimising hashing algorithms. In this case it shows that perl has done a pretty good job with the hash. > Not Split: pass2thing3ptrARRAY(0x6410)user1 : > Array Game: pass 2 thing 3 ptr ARRAY(0x6410) user 1 : > Player: pass 2 thing 3 ptr ARRAY(0x6410) user 1 In general, complex data structures will require dedicated output routines, or you can get by with a clever general purpose output routine, such as Data::Dumper or Data::Denter. -- Paul Johnson - [EMAIL PROTECTED] http://www.pjcj.net -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]