@tools = ("hammer", "chisel", "screwdriver", "boltcutter",
"tape", "punch", "pliers");
@fretools =("hammer", "chisel", "screwdriver" ,"blade");
push @tools,@fretools if grep @tools,@fretools
and i have get tools
@tools=("hammer", "chisel", "screwdriver", "boltcutter",
"tape", "punch", "pliers", "blade");
is there any easy way to do ?
The List::MoreUtils CPAN module has a
uniqfunction to do this. If you do not want to rely on this module to be installed, you can simply copy theuniqfunction from the module’s source code (since it is pure Perl) and paste it directly into your own code (with appropriate acknowledgements). In general, the advantage of using code from CPAN is that its behavior is documented and it is well-tested.