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}}()'
instead of '&{${$date_formats{$format}}{now}}()' (note the letter 's'
missing from the original).
>Otherwise you could define
>recursive hashes! Like this:
>$date_formats{yyyymmdd}{now} = $date_formats{ccyymmdd}{now};
That's exactly what I was going for!
>If you'd used strict, you would have had to declare all of those
>hashes, and would certainly have realized that you were using
>three independent ones!
FYI:
My code now begins with 'use strict;'
Note: A question as to why the seemingly unnecessary complexity of the
structure was raised. This is just a strip down of what I hope to
accomplish. It may well be more abstract then necessary, but It made sense
to me and was more entertaining than other options. I want a set of
subroutines that do basically the same thing for different date formats.
And I wanted them to be my own, rather than using 'Date::Comp' or some
other existing package because it's just more gratifying that way, more
educational, and more specific to my circumstances. The thought is to
order subroutines like 'now', 'convert_format', 'subtract_days' etc. by
their date formats, then call a single function (like 'now("dd-mon-yy")')
that selects the correct version of the routine from the from the table
based on the format.
Thanks again!
Peter
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]