To elaborate on what is causing your problem, the line $/ = &; is trying to run the subroutine ';' with the argument 'while' and assign its return value to $/ and you don't have a semicolon at the end of that statement. See perlsub on why you should not use the ampersand to call subroutines in Perl.