Jeff 'Japhy' Pinyan wrote:
>
> On Oct 25, [EMAIL PROTECTED] said:
>
> >my $month = system("date '+%b'");
> >$month = uc $month;
>
> Your problem is that you're misusing system(). system() does NOT return
> output (see perldoc -f system). If you wanted to get output, you'd use
>
> my $month = `date '+%b'`;
>
> but there's NO reason to use a system command! Use the built-in
> localtime() function:
>
> my $month = (split ' ', uc localtime)[1];
>
> localtime(), in scalar context, returns a string like
>
> "Fri Oct 25 10:30:23 2002"
>
> I'm uppercasing it, splitting it on whitespace, and getting the 2nd
> element ("OCT").
And, of course, another way to do it:
my $month = qw(JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV
DEC)[(localtime)[4]];
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]