HJ has asked for the wisdom of the Perl Monks concerning the following question:
I have been trying to parse a HDL file that has a format as below
a='0 b='001 c='110 d='1
Expected Output: a d
Code:while<> {chomp; if(~/(.*?)=\'[0|1]/) #if(~/(.*?)=\'[0-1]/) #if(~/(.*?)=\'[01]/) { print $1; } }
Actual Output: a b c d
I tried the commented 'if' statements, individually. Seem to be getting the same output. Any suggestion would help. Thanks.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Parse for a Single bit
by davido (Cardinal) on Jan 27, 2012 at 22:27 UTC | |
|
Re: Parse for a Single bit
by mbethke (Hermit) on Jan 27, 2012 at 22:27 UTC | |
by davido (Cardinal) on Jan 27, 2012 at 22:41 UTC | |
|
Re: Parse for a Single bit
by JavaFan (Canon) on Jan 27, 2012 at 23:43 UTC |