bebosoft
asked on
How can I break a loop in Perl if using 'use strict'?
I've a Perl script working perfectly and now I must add:
use strict;
at the beginning of the script in order to run it correctly in a new server.
I get an error:
Bareword "break" not allowed while "strict subs" in use at form_all_perl.pl line 137
I'm using the 'break' statement to exit a loop and it was working fine until I added the 'use strict'.
What does that error means? How can I exit a loop when using 'use strict'?
use strict;
at the beginning of the script in order to run it correctly in a new server.
I get an error:
Bareword "break" not allowed while "strict subs" in use at form_all_perl.pl line 137
I'm using the 'break' statement to exit a loop and it was working fine until I added the 'use strict'.
What does that error means? How can I exit a loop when using 'use strict'?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Can you please provide an example of a Perl script where break "works"?
If the script really was working perfectly, then you can use "break" in quotes to mean the same thing that the bareword break means under no strict subs
splain
/usr/bin/splain: Reading from STDIN
Bareword "break" not allowed while "strict subs" in use at form_all_perl.pl line 137
Bareword "break" not allowed while "strict subs" in use at form_all_perl.pl
line 137 (#1)
(F) With "strict subs" in use, a bareword is only allowed as a
subroutine identifier, in curly brackets or to the left of the "=>"
symbol. Perhaps you need to predeclare a subroutine?
splain
/usr/bin/splain: Reading from STDIN
Bareword "break" not allowed while "strict subs" in use at form_all_perl.pl line 137
Bareword "break" not allowed while "strict subs" in use at form_all_perl.pl
line 137 (#1)
(F) With "strict subs" in use, a bareword is only allowed as a
subroutine identifier, in curly brackets or to the left of the "=>"
symbol. Perhaps you need to predeclare a subroutine?
ASKER