我正在编写一个简单的 perl 脚本,它根据用户给出的小时数计算付款,并且该程序不得允许超过 500 小时的付款,但必须允许女性最多 600 小时,我正在使用除非函数,但它不起作用它允许女性超过 600 小时。
这是我使用的代码
print("Enter your working hours");
$hours=<stdin>;
print("Enter your gender");
$gender=<stdin>;
chomp($gender);
unless($gender ne "f" && $hours>=600){
print("Your have earned ",$hours*10," Birr \n");
}
else{
unless($hours>=500){
print("Your have earned ",$hours*10," Birr \n");
}
else{
print("You have worked beyond the payable hrs!");
}
}