... while (my $path = ) { # check if path component isn't in @safe_list ... }