Though, frankly, since you can use a variable name as I am doing in the factory() function, you can just avoid it altogether.sub factory { my $class_name = shift; my @args = @_; return $class_name->new( @args ); } my $foo = factory( 'Class1', $arg1 ); my $bar = factory( 'Class2', $arg2 );
In reply to Re: how to create instances of classes ....
by dragonchild
in thread how to create instances of classes ....
by Khatri
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |