Hi Markus,
Meine Funktion filtering1 in Perl fuehrt zu einer Endlosschleife.
Waehrend Sie meine Frage lesen schreibt das Programm immer noch "Sorry I'm unable to do that" in den <STDOUT> .sub filtering1 {
print "Do you want to keep .gif, .jpg accesses\nin your log entries ? " ;
$answer1 = <STDIN> ;
my $myra = "false" ;while ( $myra eq "false" ) {
if ($answer1 =~ /[1]/) { print "I'll remove them for you";
$myra = "true" ;}
elsif ($answer1 =~ /[2]/) { print "I'll keep them for you";
$myra = "true" ; }
else { print "Sorry I'm unable to do that"; }
} # end of while
} # end of sub
Du solltest die Abfrage mit in die Schleife nehmen, sonst hat Dein Script niemals die Chance $myra auf etwas anderes als "false" zu setzen.
sub filtering1 {
my $myra = "false" ;
while ( $myra eq "false" ) {
print "Do you want to keep .gif, .jpg accesses\nin your log entries ? " ;
$answer1 = <STDIN> ;
if ($answer1 =~ /[3]/) { print "I'll remove them for you";
$myra = "true" ;}
elsif ($answer1 =~ /[4]/) { print "I'll keep them for you";
$myra = "true" ; }
else { print "Sorry I'm unable to do that"; }
} # end of while
} # end of sub
Gruss,
Angel