variable interpolation of refs to anonymous subroutines

Discussion in 'Perl Misc' started by cartercc@gmail.com, May 16, 2006.

  1. Guest

    Reading from a database, I read the data into a hash of hashes.
    Actually the last hash is the key to an anonymous array, which is what
    I really want to get at, but one step at a time.)

    I have a subroutine that prints these values out very nicely, like this
    $hash1key->$hash2key->value1 value2 value3 etc. The values are what I
    really want.

    All this goes into a here document (which will be either XML or XHTML).
    Is there a way to variable interpolate the return value from the
    subrouting into the here document? Or perhaps to print directly from
    the subroutine?

    I've set my routine up as an anonymous subroutine with a reference to a
    scalar, but all I get when I read the reference in my output is a
    CODEREF and a hex dump. I've tried every permutation I can think of,
    disambiguating with braces, etc., but I haven't found any way to make
    this work, yet. I guess I could turn my here doc into a series of print
    statements, but I really don't want to do that.

    Thanks for all suggestions, CC.
    , May 16, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Nagle
    Replies:
    3
    Views:
    291
    John Nagle
    Feb 25, 2007
  2. RA Jones
    Replies:
    0
    Views:
    117
    RA Jones
    Aug 18, 2003
  3. Arne Gödeke

    creating anonymous subroutines at runtime

    Arne Gödeke, Aug 25, 2004, in forum: Perl Misc
    Replies:
    15
    Views:
    173
    Anno Siegel
    Aug 26, 2004
  4. Replies:
    29
    Views:
    194
  5. Brad Baxter

    Prototypes and anonymous subroutines

    Brad Baxter, May 31, 2007, in forum: Perl Misc
    Replies:
    10
    Views:
    328
    Uri Guttman
    Jun 2, 2007
Loading...

Share This Page