in reply to extracting data
It looks like ++moritz has identified your problems.
You might find coding it like this, is a little more readable:
#!/usr/bin/env perl use strict; use warnings; while (<DATA>) { my (undef, $def, $val) = split; print "$def\n" if ! $val or $val eq '1'; } __DATA__ #define thread 1 #define flag #define code 0 #define const (100/5) #define flag_condn 1
Output:
$ pm_define_extract.pl thread flag code flag_condn
Update: I changed the print line following moritz' comments below. It use to be:
print "$def\n" if ! $val or $val =~ /^0|1$/;
-- Ken
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: extracting data
by moritz (Cardinal) on Jun 27, 2012 at 08:25 UTC | |
by kcott (Archbishop) on Jun 27, 2012 at 09:03 UTC |