Loading ...
Sorry, an error occurred while loading the content.

Re: *$ syntax

Expand Messages
  • andy_bach@wiwb.uscourts.gov
    ... ${*{$obj}}{ net_smtp_host } = $host; My guess is $obj is the name the *{$obj} gets you to the typeglob (all the Perl variable types using the word in
    Message 1 of 4 , May 16 8:27 AM
    • 0 Attachment
      > This is unusual syntax. The following is equivalent to the above:

      ${*{$obj}}{'net_smtp_host'} = $host;


      My guess is $obj is the 'name' the
      *{$obj}

      gets you to the typeglob (all the Perl variable types using the word in
      $obj - hash, array, scalar, filehandle etc) so then
      ${*{$obj}){...

      gets you to the hash named for the work in $obj. So it's a tricky (too
      tricky?) way to work w/ a not-known-until-runtime variable name. Often
      this is done by using references too - see perldoc perlref or
      http://perldoc.perl.org/perldata.html#Typeglobs-and-Filehandles

      and
      http://perldoc.perl.org/perlref.html


      a
      ----------------------
      Andy Bach
      Systems Mangler
      Internet: andy_bach@...
      Voice: (608) 261-5738, Cell: (608) 658-1890

      "People create programs to direct processes. In effect, we conjure the
      spirits
      of the computer with our spells." - The Structure & Interpretation of
      Computer Programs
      Abelson, Sussman, and Sussman - http://mitpress.mit.edu/sicp/

      [Non-text portions of this message have been removed]
    Your message has been successfully submitted and would be delivered to recipients shortly.