in reply to magic eval variables

The expression "\$$_" is evaluated like a little Perl program and returns a value. In your case, that value seems to be a reference (an object, in fact); the insert method is then invoked on that object.

Personally, I wouldn't really recommend doing things like this unless you're really sure what you're doing. You're basically using symbolic references, since you can also do the same thing w/o the eval. For example:

$foo = "bar"; $_ = "foo"; print $$_;
This prints "bar".

A better option might be to create a hash of objects, if at all possible. But that's just my opinion.

Replies are listed 'Best First'.
RE: Re: magic eval variables
by Anonymous Monk on May 04, 2000 at 03:02 UTC
    The rub is that I don't want to use symbolic references. I want to "use strict", and the eval thingy passes. The eval lives in a loop that extracts data from a database, and inserts into a Tk widget. The whole mess lets me explicitly name all the listboxes in the GUI, and insert into them based on the exact correspondence between the name of the column and the name of the widget.