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 (
>
> 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";
>
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
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