Thanks All.

With all these examples, now I see how /x works.

Cheers,
Parag




On Mon, Dec 27, 2010 at 2:39 PM, Tim Mitchell <tmitch...@gmail.com> wrote:
> Try my $str = "HelloWorld";
>
> On Mon, Dec 27, 2010 at 2:34 PM, Parag Kalra <paragka...@gmail.com> wrote:
>>
>> Hi,
>>
>> I was under the impression that regex modifier '/x' ignores the white
>> space. So in following script both the if-else blocks should print
>> "Match" since the strings differ only in white space and '/x' should
>> ignore the white space.
>>
>> But looks like my understanding of '/x' is wrong. Could someone please
>> correct me and explain the below behavior.
>>
>> #!/usr/bin/perl
>> use strict;
>> use warnings;
>> my $str = "Hello World";
>> my $str2 = "Hello World";
>> my $str3 = "Hello    World";
>>
>> if($str =~/$str2/x){
>>    print "Match\n";
>> } else {
>>    print "No Match\n";
>> }
>>
>> if($str =~/$str3/x){
>>    print "Match\n";
>> } else {
>>    print "No Match\n";
>> }
>>
>>
>> Cheers,
>> Parag
>>
>> --
>> To unsubscribe, e-mail: beginners-unsubscr...@perl.org
>> For additional commands, e-mail: beginners-h...@perl.org
>> http://learn.perl.org/
>>
>>
>
>

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to