Hi There;
 
i have this problem of space in my program. The program requires a user to send in Either GU1 or TR1. When they send GU1 or TR1 it accepts it and that is fine. But My concern is; if they send GU 1 or TR 1(Leaving spaces before the number) then the program doesn't accept. It goes straight to the else statement. Please check the code, i'm a begginer in programming please  someone help me.. 
 
This is just part of the code;
 
#!/usr/bin/perl -w
 
use DBI;
 
$dsn= "dbi:mysql:db_manofthematch:localhost";
my $user= "mysql";
my $password = "mysql123";
$dbh = DBI->connect($dsn,$user,$password);
 
##################################GET ARGS ##########################
$msg = $ARGV[1];
$source = $ARGV[0];
 
$msg =~ s/\"/'/igx;
 
$time = localtime();
open (OUTFILE ,">>C:\\logs\\man.txt");
print OUTFILE "$time\t$source\t$msg\n";
close(OUTFILE);
 
$found = 0;
 
############################ GU ####################################
 
if (($msg=~ /gu1/i) && ($msg !~ /gu1[0123456789]+/i))
{
 $vote = 'gu1';
 $found = 1;
}
else
{
 print ".Erro.........................";
}
$dbh->disconnect;
exit;
 
Please help me.......

Reply via email to