prassi has asked for the wisdom of the Perl Monks concerning the following question:
I have a .h file with the different macro definition like given below snippet
I need to extract only variable which is assigned with 1 or 0 or blank space, like my out put has to be{ #define thread 1 #define flag #define code 0 #define const (100/5) #define flag_condn 1 }
Here is my perl which I am not able to get properly in case of #define flag which has a blank space, I used split function,{ thread flag code flag_condn }
while (<INPUT>) { my @split_data = split(' ', $_); if($split_data[2] == " "||$split_data[2]==1||$split_data[2] == 0){ print "$split_data[1]\n" } }
regards, -Prassi
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: extracting data
by moritz (Cardinal) on Jun 27, 2012 at 06:35 UTC | |
by prassi (Acolyte) on Jun 27, 2012 at 07:01 UTC | |
|
Re: extracting data
by frozenwithjoy (Priest) on Jun 27, 2012 at 06:54 UTC | |
|
Re: extracting data
by mirod (Canon) on Jun 27, 2012 at 09:33 UTC | |
|
Re: extracting data
by kcott (Archbishop) on Jun 27, 2012 at 08:18 UTC | |
by moritz (Cardinal) on Jun 27, 2012 at 08:25 UTC | |
by kcott (Archbishop) on Jun 27, 2012 at 09:03 UTC |