Re: calling a subroutine as an element of a hash table...

2003-02-10 Thread Peter_Farrar
Oops, hit send by mistake. This problem all seems to be about mistakes... Thanks to all who replied. > You have three different hashes in use. Look: I did indeed have 3 hash tables... Duh (Must have been Friday afternoon). The central problem was calling '&{${$date_format{$format}}{now}}()' i

Re: calling a subroutine as an element of a hash table...

2003-02-10 Thread Peter_Farrar
Subject: Re: calling a subroutine as an element of a hash table... | >--| Peter Farrar wrote: > Hi All, > > I swear I've called sub

Re: calling a subroutine as an element of a hash table...

2003-02-07 Thread Dave K
Peter, #!/usr/bin/perl -w use strict; my %date_formats = ( ccyymmdd => { now => sub { my @arr = localtime(); print 'Year ', 1900 + $arr[5] . ' Month '. sprintf("%02d",$arr[4] + 1) . ' Day ' . sprintf("%02d",$arr[3]); } } ); & { $date_formats{ccyymmdd}{now} }; Same output as previous

Re: calling a subroutine as an element of a hash table...

2003-02-07 Thread Dave K
Peter I saw Jenda's note and I suggest the code needs simplification. > 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 = ( > # "ccyymmdd" => {now => \ccyymmdd_now()}, > "ccyymmdd" => {now => s

Re: calling a subroutine as an element of a hash table...

2003-02-07 Thread Rob Dixon
Peter Farrar wrote: > Hi All, > > 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

Re: calling a subroutine as an element of a hash table...

2003-02-07 Thread Jenda Krynicky
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 subrouti

Re: calling a subroutine as an element of a hash table...

2003-02-07 Thread John W. Krahn
Peter Farrar wrote: > > Hi All, > > 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 causi