print "Is there a header in this file?\n"; my $header = <>; if ($header =~ m/^yes|^y]/i){ $header = "1"; } else {$header = "undef"; }