[Perl] regex skip

Itzik Lerner itzik at life-wave.com
Sat May 10 13:49:38 PDT 2003


Hi Shimon

If this code is not top secret you can post it and let us help you.
But I assume this is something like this:
------------------
while (<INPUT>) {
	/some regex/;
	command;
	.
	.
}
-------------------
if you want to continue even if you get an error then you should modify
to:
------------------
while (<INPUT>) {
	$code=<<__CODE__;
/some regex/;
command;
.
.
__CODE__
	eval $code;
}
------------------ 
or simpler:

while (<INPUT>) {
	eval {
		/some regex/;
		command;
		.
		.;
	}
}
------------------
I Hope it will help you
Itzik Lerner


-----Original Message-----

From: "Shimon Halevi" <hlovys at barak-online.net>
To: <perl at perl.org.il>
Date: Fri, 9 May 2003 18:00:46 +0200
Subject: [Perl] regex skip
Reply-To: perl at perl.org.il

Hi guys,

What is I run a perl prog and it opens a file and process it line by =
line into a new file But, in line 5436 it stops coz of a regex =
compilation ERR.

Can I code it so it will skip the line and move on to the next line?

Thanks in advance,

Shimon H.






More information about the Perl mailing list