in reply to Re: Re: Removing duplicates
in thread Removing duplicates
From the Perl debugger session I just ran:
You can fiddle with the 'list' hash as you read the file, so there's no need to use an array as the middle man.[alex@rand alex]$ perl -de 1 Loading DB routines from perl5db.pl version 1.19 Editor support available. Enter h or `h h' for help, or `man perldebug' for more help. main::(-e:1): 1 DB<1> @file1=qw/dave bob rich jim/; DB<2> @file2=qw/dave rich/; DB<3> foreach(@file1){$list{$_}=1;} DB<4> foreach(@file2){delete $list{$_};} DB<5> print "Remaining elements " . join("; ",keys %list) . "\n"; Remaining elements jim; bob DB<6>
Alex / talexb / Toronto
Life is short: get busy!
PS: When posting code, put it in between 'code' tags. That way it doesn't wrap like normal text.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: Removing duplicates
by RCP (Acolyte) on Mar 06, 2004 at 18:11 UTC |