Re: Check the entered value is single digit or not

2007-12-03 Thread Dr.Ruud
sivasakthi schreef: > I have tried to find the entered number is single digit or not.. > > the code is following, > > #! /usrbin/perl That shebang line looks a bit strange. > use strict; > use warnings; > > my $tmp=; Whitespace is cheap: my $tmp = ; > if($tmp =~ m/(\d)/) You need to (

Re: Check the entered value is single digit or not

2007-12-02 Thread sivasakthi
> > Try this improvment code: > > #! /usrbin/perl > use strict; > use warnings; > > my $tmp=; > chomp $tmp; # though it's not needed chomp it here, but you'd better > to do this. > if($tmp =~ /^\d{1}$/) > { > print"IT IS SINGLE DIGIT\n"; > } else{ > print"IT IS NOT SINGLE DIGIT\n"; >

Re: Check the entered value is single digit or not

2007-12-02 Thread Jeff Pang
On Dec 3, 2007 1:16 PM, sivasakthi <[EMAIL PROTECTED]> wrote: > Hi all, > > I have tried to find the entered number is single digit or not.. > > the code is following, > > #! /usrbin/perl > use strict; > use warnings; > > my $tmp=; > if($tmp =~ m/(\d)/) > { > print"NO IS SINGLE DIGIT\n"; > } > else

Check the entered value is single digit or not

2007-12-02 Thread sivasakthi
Hi all, I have tried to find the entered number is single digit or not.. the code is following, #! /usrbin/perl use strict; use warnings; my $tmp=; if($tmp =~ m/(\d)/) { print"NO IS SINGLE DIGIT\n"; } else { print"NO IS NOT SINGLE DIGIT\n"; } but it always passed the condition even if we ent