in reply to whats wrong with this break ?
If you had used strict, Perl would have told you as much.
use strict; use warnings; while (<STDIN>) { print "--> $_"; if ( /^2/ ) { break; } print "--> $_"; } while (<STDIN>) { print "==> $_"; }
yields
Bareword "break" not allowed while "strict subs" in use at fluff.pl li +ne 7. Execution of fluff.pl aborted due to compilation errors.
Please read Use strict warnings and diagnostics or die (and The strictures, according to Seuss for a chuckle) to understand why strict will make your life dramatically easier.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: whats wrong with this break ?
by TomDLux (Vicar) on Sep 17, 2010 at 16:54 UTC |