#!/usr/bin/perl use strict; use warnings; my @passwords = qw/ foo bar /; my $count = 0; { print "Passwort eingeben: "; chomp( my $input = ); last if grep { $input eq $_ } @passwords; die "3 mal Falsch eingegeben.\n" if ++$count == 3; redo; } print "Access Granted\n";