Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

How to combine these 2 subroutines in one?

by Anonymous Monk
on Apr 03, 2014 at 11:02 UTC ( [id://1080927]=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    Make a subroutine that removes duplicates from a list. If the list is 
    +passed as an array, then return a clean list. If the list is passed a
    +s a reference to an array then clean the given array in place.
    
  2. or download this
    sub clean_list {
    
    ...
               }
        }
    
  3. or download this
    open(IN, '<', 'myfile') or die "Could not read file\n";
    my @array_with_duplicates = <IN>;
    ...
    print OUT @array_no_duplicates;
    close OUT;
    
  4. or download this
    sub clean_array 
    {
    ...
      @{$_[0]}=keys %hash;
    }
    
  5. or download this
    open(IN, '<', 'myfile') or die "Could not read file\n";
    my @initial_array = <IN>;
    ...
    print OUT @initial_array;
    close OUT;
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1080927]
Front-paged by Arunbear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (5)
As of 2024-04-25 14:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found