Mistakes that I can see in the code
Mistakes that I can see in the code. Seeing if user typed y or Y it prints out a message that the test is rerunning. Typing n or N will set a value which probably stops the test.
The problem with the code is that it is checking for n or N only to stop the test. The user types anything other then “n” or “N” the test will still run, but you will get no message that it is running.
Likewise earlier in the code $data will be in an undetermined value if the user doesn’t type in “y”,”Y”,”n”,”N”.
Also appears look like to me a regex expression which is saying “The following two characters only at the start of the line and at the end of the line”. So something like ” y” would not be the same as “y”.
Better regex would prehaps be “/y/i” or “/n/i” but even that would have problems.
second elsif appears to have a line break between the if statement as well. But that might be valid syntax.