On Mon, 2002-05-13 at 10:45, Damir Horvat wrote:
> Hi!
>
> I'm having problem dereferencing:
> ---
> %err = (
> "usage" => sub { die "\nUsage: $0 <zone> <master|slave>\n" },
> "zone" => sub { die "Zone allready exists!\n" }
> );
>
> $zone = lc $ARGV[0] || $err{'usage'};
> print "$zone\n";
> ---
>
> bash-2.05a$ perl dnsaddzone.pl
> CODE(0x804eed0)
>
>
> --
> ..................................
> Damir Horvat
> System administrator
> VOLJATEL telekomunikacije d.d.
> Smartinska 106
> SI-1000 Ljubljana
> Slovenia
> ..
> Tel. +386.(0)1.5875 832
> Fax. +386.(0)1.5875 899
> www.voljatel.si
> E-mail: [EMAIL PROTECTED]
> ..................................
You need to add parentheses to dereference a coderef.
<example>
#!/usr/bin/perl
use strict;
my %err = (
"usage" => sub { die "\nUsage: $0 <zone> <master|slave>\n" },
"zone" => sub { die "Zone allready exists!\n" }
);
my $zone = lc $ARGV[0] || $err{'usage'}();
print "$zone\n";
</example>
--
Today is Pungenday the 60th day of Discord in the YOLD 3168
You are what you see.
Missile Address: 33:48:3.521N 84:23:34.786W
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]