CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Intermediate: [Solved] Print references: Edit Log


May 5, 2013, 8:45 PM

Views: 1930
[Solved] Print references

Greetings again. Wow, twice in one day! Smile

As a curiosity that has come up in debugging, I would like to sometimes print the value of a reference, not the object it points to. When I'm int he debugger and I have a reference to an array, like

$a = \@some_list

I can type

p $a

and get a hex value of some sort. But when I try to do this for an object reference I get a complaint about no method. Now that message makes some sense because, normally, when when someone wants says

print $some_object

they *do* mean to display the contents of said object. (HMMmm, I haven't tried it for an unblessed hash.)

Similarly, if I want to see if to object references are referencing the same object, I might try:

if ($ref1 == $ref2) {..}

but I will get a very similar complaint, for the same reason as with the print command.

So how *do* I display or compare references as a scalar quantity?

Thanks much.
-- Rasputin Paskudniak (In perpetual pursuit of undomesticated, semi-aquatic avians)

(This post was edited by rpaskudniak on May 7, 2013, 8:20 PM)

Edit Log:
Post edited by rpaskudniak (User) on May 7, 2013, 8:20 PM

Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives