You have the right idea, but you made a few somewhat obvious mistakes. To debug an RE, you need to go through it carefully to see why it's not working, and break it down into smaller bits until you can see what's going on. Here are the problems I found:
- You put an extra backslash before \s, so the RE was looking for a literal backslash followed by the letter s.
- Your number pattern in $f1 doesn't take the second column into account, which has no decimal point and a comma.
This version seems to do what you want:
$fl = '-?\d+\.?\d*,?';
$levene = $4
if /TEST FOR VARIANCES\s+(${fl})\s+(${fl})\s+(${fl})\s+(${fl})/;
It looks like your data might line up in the same character positions every time, in which case using unpack or substr might be an easier option.
Good luck!