I have an array of cities and I would like it to return true if someone types in all or part of a city name. So "lak" ,"l", and "lakesi" would all return true for "lakeside". It must be spelled correctly, I am not just trying to match some letters in a city name and it must start from the beginning of the word, so "lksd" and "kside" would return false. Can you tell me a regular expression to do this?
example:
$city = <STDIN>;
foreach $mycity (@cities_array)
{
if($city =~ [some regex stuff]/$mycity/)
{
print "Some Output";
}
}
example:
$city = <STDIN>;
foreach $mycity (@cities_array)
{
if($city =~ [some regex stuff]/$mycity/)
{
print "Some Output";
}
}