in reply to Passing hash references into subs

At least in my experieance the -> operator doesn't interpolate. You can do one of two things:

print $book_ref->{'name'},"<br>\n";
Or:
print "$$book_ref{'name'}<br>\n";

To me the first method seems cleaner but its just personal preference.

Hope that helps
Chris

UPDATE: I stand totally correctly and apologize for my ignorance. Thanks thelenm :)

Lobster Aliens Are attacking the world!

Replies are listed 'Best First'.
Re: Re: Passing hash references into subs
by thelenm (Vicar) on Jul 18, 2002 at 04:06 UTC
    The original code should work fine. Try this example:
    my $hashref = {'name' => 'Homer'}; print "$hashref->{'name'}\n";

    -- Mike

    --
    just,my${.02}