[thelist] Convert php to perl

CDitty mail at redhotsweeps.com
Wed Aug 1 21:46:19 CDT 2001


I am creating a perl version of a php game I wrote some time 
ago.   Unfortunately, my knowledge of perl is rather limited.  In PHP, 
there is a function called in_array.  I have not been able to find an 
equivalent in perl.   Can anyone offer any advice I completing this section?

$winning_id = 1;
$max_id = 5;

for($count = 1; $count < 3; $count++ )
{
do{
         $tmp = int(my_rand($max_id)) + 1;
}while(in_array($tmp, $my_rand) || ($tmp == $winning_id));  # <------ 
In_array line
         $my_rand[$count] = $tmp;
}

Thanks for any help

Chris





More information about the thelist mailing list