From: "John W. Krahn" <[EMAIL PROTECTED]>
> Peter Farrar wrote:
> > I swear I've called subroutines this way before, but I can't find
> > any examples. In this case, I'm looking to build some time/date
> > functions. Regardless of what the actual code is supposed to do,
> > the calling of subroutines as elements of a hash is causing me
> > grief. I am receiving the following message:
> >
> > Undefined subroutine &main:: called at D:
> > \perldev\workroom\dates\dates.pl line 16.
> >
> > Here is the code. Can anyone see what I am doing wrong here???
> >
> > TIA,
> > Peter
> >
> > P.S. you can see where I comment out the ccyymmdd_now function.
> > That approach works, but is not what I'm shooting for.
> >
> > %date_formats = (
>
> Make sure you declare %date_formats before you assign to it so the
> 'yyyymmdd' key will see it.
This will not help. Try:
#!perl
my %hash;
%hash = (
a => 1,
b => 2,
c => $hash{a},
d => $hash{b},
);
use Data::Dumper;
print Dumper(\%hash);
You have to split the hash creation:
%hash = (
a => 1,
b => 2,
);
$hash{c} = $hash{a};
$hash{d} = $hash{b};
use Data::Dumper;
print Dumper(\%hash);
Jenda
P.S.: Sorry if I got lost in the code and misunderstood your
suggestion.
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]