Luis Pachas wrote:
Hi I have a problem,

I noticed several problems.

I have a PM

i have this
A.pm :

package A;

my %b;

$b = {

Must be global. And you need to decide if you want a hash or a hash reference. I'm assuming a hash reference.


    our $b = {

   apple => \&foo1,
   oranges => \&foo2,
   open => \&foo3
};

sub foo1 {
  print "apples\n"
}

sub foo2 {
  print "oranges\n"
}

sub foo3 {
  my ($item) = @_;
  print $item."\n"
}

1;

## End Module

MAIN :

!#/bin/perl

lib "$ENV/";
use MOD::A;

$MOD::A::b{foo1}->();
$MOD::A::b{foo2}->();
$MOD::A::b{foo3}->("pairs");

Still assuming hash references, do you mean:

    $MOD::A::b->{apple}();
    $MOD::A::b->{oranges}();
    $MOD::A::b->{open}("pairs");

I went around this by having the Hash of symbolic references in the main namespace so it works...

Which hash of symbolic references? They are hard references, not symbolic.

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to