in reply to Re: Importing dynamic variables
in thread Importing dynamic variables
This whole idea makes me want to throw my hands in the air and run out of the room screaming as though my hair were on fireI knew that would be the response when I posted! Still, I'm curious to know how to get this to work.
It should not be "use gen_var($one);", but rather, "use gen_var qw( one );"But wouldn't that import the subroutine "one" and not the variable "$one"?
As long as you're doing this, wouldn't it be easier to directly manipulate the symbol table as a hash?I did try that accessing the symbol table. Say each variable was an object and not a scalar
and from the classing package:package gen_var; use banana; my @variables = qw(one two three); my $counter = 1; foreach my $variable (@variables) { no strict; *$variable = banana->new($counter++) } 1;
That doesn't work, but I'm not sure how to fix it...use gen_var; $one->get_counter();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Importing dynamic variables
by Anonymous Monk on Nov 17, 2006 at 00:30 UTC | |
by Anonymous Monk on Nov 17, 2006 at 01:46 UTC | |
by BUU (Prior) on Nov 17, 2006 at 02:31 UTC |