use strict; use warnings; open (my $readfile,'<',"textfile.txt") or die $!; while (my $line=<$readfile>) { chomp ($line); if ($line =~ /^\d+$/) { print "Digit gefunden: $line\n"; } elsif ($line =~ /\A\w+\z/) { print "String gefunden: $line\n"; } } close ($readfile);