awohld has asked for the wisdom of the Perl Monks concerning the following question:
You can see that the $city variable is just a city name and the $cityState variable is the City with a comma and then the state.$city = "Chicago"; $cityState = "Chicago, IL";
#!/usr/bin/perl my $city = "Naperville"; my $cityState = "Chicago, IL"; if ( $cityState =~ /\$city+/) { print "They match!"; } else { print "dont match"; }
#!/usr/bin/perl my $city = "Chicago"; my $cityState = "Chicago, IL"; if ( $cityState =~ /\$city+/) { print "They match!"; } else { print "dont match"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Matching Part of a String in a IF Statment
by Corion (Patriarch) on Dec 12, 2005 at 08:53 UTC | |
|
Re: Matching Part of a String in a IF Statment
by murugu (Curate) on Dec 12, 2005 at 09:06 UTC | |
by Fletch (Bishop) on Dec 12, 2005 at 14:57 UTC |