Re: The map function
- From: Gunnar Hjalmarsson <noreply@xxxxxxxxx>
- Date: Thu, 24 Apr 2008 03:30:48 +0200
Gerry Ford wrote:
"Jürgen Exner" <jurgenex@xxxxxxxxxxx> wrote in message news:21mr04pro5k3sqjbebv5g2jq5i0doq42t3@xxxxxxxxxxHowever, I wonder what you are trying to achive by using eval in the
first place. I don't see any need for it.
I could just omit it?
It's up to you; I for one do see a need for it: It prevents a fatal error for the case a line is not a valid regular expression.
C:\home>type test.pl
my @filter;
while (<DATA>) {
chomp;
next unless length;
next if /^#/o;
my $pat;
eval '$pat = qr($_)' or do { warn $@; next };
push @filter, $pat;
}
print "$_\n" foreach @filter;
__DATA__
\w+).+?
\s+
C:\home>test.pl
Unmatched ) in regex; marked by <-- HERE in m/\w+) <-- HERE .+?/ at (eval 1) line 1, <DATA> line 1.
(?-xism:\s+)
C:\home>
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
.
- References:
- The map function
- From: mynews
- Re: The map function
- From: Jürgen Exner
- Re: The map function
- From: Gerry Ford
- Re: The map function
- From: Tad J McClellan
- Re: The map function
- From: Gerry Ford
- Re: The map function
- From: Uri Guttman
- Re: The map function
- From: Gerry Ford
- Re: The map function
- From: Jürgen Exner
- Re: The map function
- From: Uri Guttman
- Re: The map function
- From: Gerry Ford
- Re: The map function
- From: Jürgen Exner
- Re: The map function
- From: Gerry Ford
- The map function
- Prev by Date: Re: The map function
- Next by Date: Re: use of DBI; I am getting multiple error messages mixed in with the correct output.
- Previous by thread: Re: The map function
- Next by thread: Re: The map function
- Index(es):
Relevant Pages
|
Loading