use strict; my $lookfor; if ($line =~ /TC/g) { $lookfor = "TC"; } else { $lookfor = "26 "; } print $lookfor;