Re: can not filter out commentary lines with reg-exps
- From: krahnj@xxxxxxxxx (John W. Krahn)
- Date: Wed, 29 Mar 2006 16:14:03 -0800
Harald wrote:
Hi,
Hello,
I need to parse an ASCII file which first rows are comments. Those rows
are marked by a '#' at their beginning.
You need to use '^' instead of '\' to indicate the beginning of a line.
I try to filter them out by
while( <$FH> =~ m{\#*} )
{}
But this does not work. The loop does never stop.
What goes wrong? I am really confused!
Your pattern says to match zero or more of the '#' character and every line in
your file has at least zero '#' characters. You want something like:
1 while <$FH> =~ /^#/;
John
--
use Perl;
program
fulfillment
.
- References:
- can not filter out commentary lines with reg-exps
- From: Harald
- can not filter out commentary lines with reg-exps
- Prev by Date: GDBM_File help
- Next by Date: Re: How to split a string read from the file?
- Previous by thread: Re: can not filter out commentary lines with reg-exps
- Next by thread: How to split a string read from the file?
- Index(es):
Relevant Pages
|