Do you really need to use split? Why not match exactly what you want in the main loop?
#!/usr/bin/perl
use strict;
use warnings;
use feature 'say';
while (<DATA>) {
# should you need it, the value is in $2, undef if not present
say $1 if m{^ \s* \#define \s+ (\S+) (?:\s+ (0|1))? \s* $}x;
}
__DATA__
#define thread 1
#define flag
#define code 0
#define const (100/5)
#define flag_condn 1
A couple of notes: if you are using an ancient (pre 5.10) perl, then don't use use feature 'say'; and say, instead use print $1, "\n";. The /x modifier allows nicer formating for the regexp: whitespace is ignored, comments are allowed (hence the \# here, since it's not a comment) and the regexp can be spread over several lines.