I have an array that contains the initial 2 characters of zip codes in perl, for example:
@acceptedPostcodes = ("CV", "LE", "CM", "CB", "EN", "SG", "NN", "MK", "LU", "PE", "ST", "TF", "DE", "WS");
I have a search box in which the user enters a part or full postal code. I need to check if the zip code he entered started with one of the array elements, for example, if they entered “CV2 1DH”, it would evaluate to true, and if they entered something like “YO1 8WE”, it will be false , it does not start with one of the array values.
Now it would be easy to do in PHP for me, but Perl is not too good, and so far my efforts have not been very fruitful.
Any idea visible?
source
share