$Server_connection10=new IO::Socket::INET->new(LocalPort=>2010,Proto=>"udp"); $battle_accept = threads->new( sub{ while($Server_connection10->recv($text2,10000)){ ($attacked,$attacker,$damage,$nothing) = split("----", $text2); if($attacked =~ m/phasers/i){ if($shields eq "on"){ print"\nWe have been attacked by the $attacker!!"; $shield -= ($damage / 10); $shield10 = $shield * 10; print"Shields are at $shield10!"; if($shield <= 0){ print"\nShields are down!!"; $shields = "off"; } }else{ print"\nWe have been attacked by the $attacker!!"; $hull -= $damage; print"Hull integrity is at $hull!"; if($hull <= 0){ print"YOU HAVE BEEN DESTROYED BY THE $attacker."; $again = 1; $dead = 1; } } }else{ if($shields eq "on"){ print"\nWe have been attacked by the $attacker!!"; $shield -= ($damage / 50); $shield10 = $shield * 10; print"Shields are at $shield10!"; if($shield <= 0){ print"\nShields are down!!"; $shields = "off"; } }else{ print"\nWe have been attacked by the $attacker!!"; $hull -= int($damage * 1.5); print"Hull integrity is at $hull!"; if($hull <= 0){ print"YOU HAVE BEEN DESTROYED BY THE $attacker."; $again = 1; $dead = 1; } } } } } );