in reply to Substring comparisson problem
Hi ChTidio,
say
substr+lc crypt(qw $i3 SI$),4,5
It's because you're looking for the substring "Hello" with the quotes. Get rid of them and try again:
my $string = "Hello World"; if ($string =~ /Hello/) { print "Basic String contains: Hello\n"; }
Update: You could also put quotes around 'Hello' with any of the following (among other possibilities):
my $string = "\"Hello\" World"; my $string = '"Hello" World'; my $string = q{"Hello" World}; my $string = qq{"Hello" World};
Then your original regex should find the quoted substring "Hello":
if ($string =~ /"Hello"/) { print "Basic String contains: Hello\n"; }
In Section
Seekers of Perl Wisdom