K.Moeng wrote:
Hello again,

I have rephrased my question from yesterday,

I want to be able to ignore the white space in between ROAM and ACT
that is return the query as ROAM ACT without falling to the else statement.

$msg = $ARGV[0];

$msg =~ s/\"/' /ig;

$found = 0;

if ($msg =~ /roam act/i)
{
 $name = 'ACTivated';
 $found = 1;
}

elsif ($msg =~ /roam dact/i)

{
 $name = 'DeACTivated';
 $found = 1;
 }

 if ($found == 1)

print ".Thank you..........................\n";
}

else
{
 print "Sorry. Your request has not been sent for Roaming.\n";
}



Hello,

So you basicly mean to match  FOOroam<a number of spaces>actBAR ?

if( $msg =~ /roam +act/i) will match a number of spaces larger than or equal to 1: "roam act and roam act but not roamact" if( $msg =~ /roam *act/i) will match zero or more spaces: "roam act and roam act and roamact"
while the code you wrote
if( $msg =~ /roam act/i) will match exactly one space so only "roam act"

I also assume you are aware that your "if ($found)" block is in the wrong place as it should be beneath the else (or another one should be added in the first if block.

Or do you still mean something else ?

hth
E.

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to