I just tried the code with some very minor changes and it worked for me. I doubt that my changes "fixed" anything, but here is my modified version in its entirety:
When run it produced:use strict; use warnings; print makeDate(),"\n"; sub makeDate{ my @days = ("Sun","Mon","Tues","Wed","Thurs","Fri","Sat"); my @mons = ("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","S +ept","Oct","Nov","Dec"); my ($mday,$mon,$wday,$year); (undef,undef,undef,$mday,$mon,$year,$wday,undef,undef) = local +time(time); $year = 1900 + $year; my $date = "$days[$wday] $mons[$mon] $mday $year"; return $date; }
--$ perl /tmp/mystic.pl Thurs Feb 19 2004
Since you did not provide the calling environment's code I don't know what might be going wrong there, but that's where I'd look...
| Peter L. Berghold -- Unix Professional Peter at Berghold dot Net | |
| Dog trainer, dog agility exhibitor, brewer of fine Belgian style ales. Happiness is a warm, tired, contented dog curled up at your side and a good Belgian ale in your chalice. | |
In reply to Re: Using RETURN in a sub
by blue_cowdawg
in thread Using RETURN in a sub
by MysticFallout
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |