Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Removing users from a list

by 2teez (Priest)
on Sep 09, 2012 at 00:41 UTC ( #992544=note: print w/ replies, xml ) Need Help??


in reply to Removing users from a list

Hi,

What have you tried using Perl?
Really, there is no way, one can help except giving "assumed" examples, since no code, examples, likes or modified script was not given.
However, if this might help.
Get all the user from the masterlist.txt, then iterate through the removelist.txt, to remove from the masterlist hash, names contained in the removelist that matches. Then print out all the remaining users in the masterlist hash.

UPDATE:
Please, if I may illustrate the point above, using an example that could help.
Note:
This might not be the perfect example, but am sure it will give up a head up.
masterlist.txt

barak osama bush jonathan perl python java c++

removelist.txt
osama jonathan python java
#!/usr/bin/perl use warnings; use strict; my %new_list; read_n_work_file( 'masterlist.txt', sub { undef $new_list{ $_[0] } } ) +; read_n_work_file( 'removelist.txt', sub { delete $new_list{ $_[0] } if exists $new_list{ $_[0] } } ); print join "\n" => keys %new_list; # print to a new file sub read_n_work_file { my ( $file, $workout ) = @_; open my $fh, '<', $file or die "can't open file:$!"; while (<$fh>) { chomp; $workout->($_); } }

output
bush barak perl c++


Comment on Re: Removing users from a list
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://992544]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (10)
As of 2014-11-27 09:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (183 votes), past polls