while () { chomp; next if /^>\s*/; print "MATCH => $_\n"; } __DATA__ >Sensor30 >FooSensor30 > Sensor30 Sensor300 Sensor30 >Sensor3