Re: Reversing Digits

2007-01-08 Thread John W. Krahn
Dharshana Eswaran wrote: > Hi all, Hello, > I was trying to reverse the digits. > > For eg: if i have 50, i wanted to print 05 > > Can anyone tell me a simple way? $ perl -le'my $digits = "05"; print for $digits, scalar reverse $digits' 05 50 John -- Perl isn't a toolbox, but a small machin

Re: Reversing Digits

2007-01-08 Thread Deepak Barua
Basically you can use the divide modulus % and then eliminate the digit using normal divide... but then the cooler way is to convert to BCD and then extract nibble by nibble... Regards Deepak On 1/9/07, Dharshana Eswaran <[EMAIL PROTECTED]> wrote: Hi all, I was trying to reverse the digits. F

Reversing Digits

2007-01-08 Thread Dharshana Eswaran
Hi all, I was trying to reverse the digits. For eg: if i have 50, i wanted to print 05 Can anyone tell me a simple way? Thanks and Regards, Dharshana