Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

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


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.

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

barak osama bush jonathan perl python java c++

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->($_); } }

bush barak perl c++

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

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (1)
As of 2015-11-27 04:33 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (718 votes), past polls