Konopaske Jr,Raymond E wrote: > Forgive me if this is a dumb question. I'm a newcomer to Perl. > > I was trying to do something the other day and ran across this odd > little problem. > > I had some lines in my script that looked something like this: > > $ddd = 8; > ... > if ($ddd == 08) {print ('hi');} > > When I tried to run, I would get the following error: > > Illegal octal digit at C:\atest\tryme.pl line 2, at end of line > Execution of C:\atest\tryme.pl aborted due to compilation errors.
A numeric constant starting with a zero is treated as base-8. Octal numbers use digits 0-7 only, obviously. See "perldoc perldata" under the (not-so-obvious) heading "Scalar value constructors" If you want to check for the number 8 (base 10), you need $ddd == 8 (or if you prefer octal, $ddd == 010) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>