Question:

Remove the duplicate data from @array=(“perl”,”php”,”perl”,”asp”)

Answer:

sub uniqueentr
 
{
 
return keys %{{ map { $_ => 1 } @_ }};
 
}
 
@array = ("perl","php","perl","asp”);
 
print join(" ", @array), "\n";
 
print join(" ", uniqueentr(@array)), "\n";

 


Keywords:

© 2017 QuizBucket.org