use strict; use warnings; my %dispatch = ( 0b000001 => \&noneTrue, 0b111110 => \&allTrue, 0b001101 => \&firstLine, ); my $name = ''; my $vorname = 'full'; my $plz = 1; my $tel = 0; my $tel49 = undef; while () { chomp; my ($name, $vorname, $plz, $tel, $tel49) = split ','; my $vector = (!$name) || 2; $vector |= (!$vorname) || 4; $vector |= (!$plz) || 8; $vector |= (!$tel) || 16; $vector |= (!$tel49) || 32; $dispatch{$vector}->($.) if exists $dispatch{$vector}; } sub noneTrue { print "None true in input line $_[0]\n"; } sub allTrue { print "All true in input line $_[0]\n"; } sub firstLine { print "Matched first line pattern at input line $_[0]\n"; } __DATA__ ,full,1,0, first,second,3,4, 1,2,3,4,5 ,,3,4, last,,,,