in reply to Re: Variable interpolation of object methods
in thread Variable interpolation of object methods

Browseruk, can you explain why your deferencing method worked but mine didn't. I thought perl was deferencing the refernce for the gene object by using the -> notation. Whta exactly are you deferencing as the display_id method doesn't retrun a reference. thanks
  • Comment on Re^2: Variable interpolation of object methods

Replies are listed 'Best First'.
Re^3: Variable interpolation of object methods
by Anonymous Monk on Oct 30, 2010 at 23:21 UTC
    are you creating a reference to this variable $gene->display_id and then deferencing it straight away with ${ } Why do you have to do this? Why doesnt perl perform variable interpolation of these types of things out of the box as it were?

      When the interpolation has read $gene, it stops parsing and so never sees the dereference (->).

      Whereas, inside ${ ... }, it expect any code, so it is parsed using the full Perl parser, rather than a limited parser looking only for a variable name.

      Note:That's my fits-the-evidence assumption, not definitive deep source-diving knowledge.


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.