\A(?<!compiled) means "The start of the string, followed by {the previous 8 characters are not 'compiled'}." The start of the string is never going to be preceeded by 'compiled', so that's always going to match.
substr($file, 0, 8) eq 'compiled' or $file !~ /\A[a-zA-Z0-9]+\z/
can be written as
$file =~ /\Acompiled/ or $file !~ /\A[a-zA-Z0-9]+\z/
which can be written as
$file =~ /\Acompiled/ or $file =~ /[^a-zA-Z0-9]/
which can be written as
$file =~ /\Acompiled|[^a-zA-Z0-9]/
The final line reads as: "It's an error if the filename starts 'compiled', or if it contains unsafe characters."
Update: I described \A(?<=compiled) instead of \A(?<!compiled). Fixed.
In reply to Re: Failed regex: negative look-behinds
by ikegami
in thread Failed regex: negative look-behinds
by loikiolki
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |