You can pass arguments like so:

$commands{$string}->($arg1,$arg2);

> I gave up on the code below and downloaded the switch module 
> from cpan.
> This was a simple solution that filled my immediate need, 
> however I am still
> interested in the capabilities of loading a hash with 
> subroutine calls and
> the details of submitting arguments to those subroutines.(I 
> don't understand
> quite how to do that)

...snip...

> 
>     my %commands = (
>         "happy" => \&joy,
>         "sad",  => \&sullen,
>         "done"  => sub { die "See ya!" },
>         "mad"   => \&angry,
>     );
> 
>     print "How are you? ";
>     chomp($string = <STDIN>);
>     if ($commands{$string}) {
>         $commands{$string}->();
>     } else {
>         print "No such command: $string\n";
>     }
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to