This code works for me:
use strict; package foo; sub bar { print "Works\n" } package main; my $var = "bar"; foo->$var;
It's possible that your error is somewhere else. Perl's error messages are often, um, less then perfect at pointing to the real place the error is at.
----
I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
-- Schemer
: () { :|:& };:
Note: All code is untested, unless otherwise stated
In reply to Re: Syntax question...
by hardburn
in thread Syntax question (Perl 5.005)...
by freddo411
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |