> >>> I have a variable which could contain any number from 01-12. I need > >>> to remove the leading zero from numbers 01-09, otherwise I get an > >>> "octal digit" error when the number is used in a calculation. Can > >>> anyone show me how to remove that leading zero? > >> > >> use warnings; > >> use strict; > >> > >> my @numbers = qw ( 01 02 03 04 05 ); > >> > >> for my $num (@numbers) { > >> $num = int $num; > > no need for int. perl coerces numbers to strings and vice versa on > demand. int is actually used to truncate the fraction off of a float, > not to convert a string to a number. > > G> That got it. Thank you Steve and Uri. > > you never posted the code that was bothering you. it would be helpful to > us and yourself to post it. your quoted error made no sense to me given > what you also said. > > thanx, > > uri
I use interchange (icdevgroup.org) and things like this always trace back to the extra layer. Please let me know if that is satisfactory. - Grant -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/