Oliver Schnarchendorf wrote: > On Fri, 2 Apr 2004 12:19:32 -0800 , Bajaria, Praful wrote: > > However, when I print > > print "content $request->content \n"; I get "content > > HTTP::Request=HASH(0x8546b3c)->content" > > and print "$response->message \n"; give me "message > > HTTP::Response=HASH(0x8546b60)->message" > > > > Am I doing something wrong here ? > Yes... but unknowingly. You are trying to print what a hash function returns > ($hash->function). The problem is that perl doesn't see it this way. It will just > print the data type of the hash variable (HASH(0x0000000)) and see everything > following the hash variable (->function) as normal text.
That too, perhaps. In more general terms, function calls are not interpolated within strings. > There are a few ways around this. The easiest two for you are > > (a) Store the value returned by the hash-function in another variable before > you use it: > > my $content = $request->content; > print "content: $content\n"; > > (b) Use the perl way of concatenating strings with '.''s: > print "content: ".$request->content."\n"; Option (b) above is generally my approach for function calls. So far its been very dependable. Joseph -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>