in reply to Help with an array Conversion

What message do you get in your server error log?

What you show will work if used properly [Oops, not quite - Paladin++ caught a true error]. You're not showing exactly how you get $day or what happens if a value for an undefined key is read from the hash.

With a numerical sequence of keys, an array may be more natural than a hash for that. One of the many time string utilities may be better yet. I like,

use POSIX 'strftime'; my $dayname = strftime '%A', localtime;
That will honor locale, so anybody can run your script and get the day named in their own language.

After Compline,
Zaxo

Replies are listed 'Best First'.
Re^2: Help with an array Conversion
by barrycarlyon (Beadle) on Apr 26, 2006 at 21:42 UTC

    my (undef, undef, undef, undef, undef, undef, $day, undef, undef) = localtime(time);

    And the error log: still searching the error log,

    changed () to {} still an error

    error log:

    Wed Apr 26 21:40:03 2006 alert client 86.141.242.181 /home/lsrfm/webs/www.lsrfm.com/htdocs/.htaccess: Global symbol "$DAYS_OF_WEEK" requires explicit package name at /home/lsrfm/webs/www.lsrfm.com/perllib/LSRfm/Base.pm line 271. /weblogs/lon-web-1/httpd-error.log:syntax error at /home/lsrfm/webs/www.lsrfm.com/perllib/LSRfm/Base.pm line 271, near "$DAYS_OF_WEEK(" /weblogs/lon-web-1/httpd-error.log:BEGIN failed--compilation aborted at /home/lsrfm/webs/www.lsrfm.com/perllib/LSRfm/Application/Home.pm line 5. /weblogs/lon-web-1/httpd-error.log:Compilation failed in require at /home/lsrfm/webs/www.lsrfm.com/htdocs/.htaccess line 8. /weblogs/lon-web-1/httpd-error.log:BEGIN failed--compilation aborted at /home/lsrfm/webs/www.lsrfm.com/htdocs/.htaccess line 8.

    Barry Carlyon barry@barrycarlyon.co.uk

      Ah, very good, you're using strict. You need to declare my $DAYS_OF_WEEK; or use vars $DAYS_OF_WEEK; somewhere at or before first using the name. The error Paladin caught will then crop up unless you've already fixed it.

      After Compline,
      Zaxo