In my perl script I use the unix command 'date' to make a time stamp because eventually I want the date format to be DD-MON-YYYY, where DD is the number of the day (1-31), MON is the 3-char spelling of month (i.e. JAN), and YYYY is the 4-digit year. In this perl script I'm just testing for the date so the day and year aren't in this script. The date command returns the month as a two digit number which I pass to my routine. My routine then changes the two digit number into the corresponding 3-char letters for that month. I get an error message like
Illegal octal digit '8' Illegal octal digit '9' when my routine uses the number 08 and 09. I don't understand what this error means. If I change my routine to use 8 and 9 I don't see this error message. The number for April is 04 and that doesn't seem to cause a problem. What is special about numbers 08 and 09? Here is the code: ( thanks, Chee ) #!/usr/local/bin/perl -w # use strict; use vars qw($mm $mon); $mm = `date +%m`; $mon = &convertMO($mm); print "month is $mon\n"; exit; sub convertMO { my ($tmp) = @_; my $xmon; if ( $tmp == 01 ){ $xmon = 'JAN'; } if ( $tmp == 02 ){ $xmon = 'FEB'; } if ( $tmp == 03 ){ $xmon = 'MAR'; } if ( $tmp == 04 ){ $xmon = 'APR'; } if ( $tmp == 05 ){ $xmon = 'MAY'; } if ( $tmp == 06 ){ $xmon = 'JUN'; } if ( $tmp == 07 ){ $xmon = 'JUL'; } if ( $tmp == 08 ){ $xmon = 'AUG'; } #<-- illegal error if ( $tmp == 09 ){ $xmon = 'SEP'; } #<-- illegal error if ( $tmp == 10 ){ $xmon = 'OCT'; } if ( $tmp == 11 ){ $xmon = 'NOV'; } if ( $tmp == 12 ){ $xmon = 'DEC'; } return $xmon; } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>