AaronGeorg,
When you read in from a text file you read line by line. If you wanted to go the string route that you tried and only get the first line, you could try doing this.
local $/;
$/=undef;
This is the line seperator. The default is the new line. That way, you just read in the first line. In the above, you can undef the line seperator, passing in the whole file into the string. Then you can do your reg. exp. Unfortunately, doing your pattern match on license will yield a true because you have more than one license in the string. So you may be searching for license, thinking you'd get gym license, and if the record doesn't have the gym one, it still may be true if there is another license. A pattern match on 'gym license' can work, but what if you have 'no gym license' or something that looks like the pattern but means the opposite.
I suggest opening the file handle and setting an array equal to the file handle, as suggested by others.
@array=<filehandle>;
foreach my $array(@array){
#this match should yield only gym license on the line.
if ($array=~/^gym license\n$/i){
####do your stuff here
}
}
Hope this helps.
Mike