Here is a small piece of code if it could be helpful.
################## START #########################
#!f:/perl/bin/perl.exe
# set the above to your perl path.
use strict;
use warnings;
use CGI qw(:standard);
use CGI::Carp 'fatalsToBrowser';
my $q = new CGI;
open (DUPF,"dupes.txt"); # name of the file containig dupes to be removed.
open (OUTF,">>dupes_removed.txt"); #new file with dupes removed.
my %saw;
print OUTF grep(!$saw{$_}++,<DUPF>);
close OUTF;
close DUPF;
print $q->header();
print "Duplicate Enteries Removed";
exit;
##################### End of Code ####################################
Thanks,
Sara.
----- Original Message -----
From: "Adedayo Adeyeye" <[EMAIL PROTECTED]>
To: "'David Dorward'" <[EMAIL PROTECTED]>; "'Perl Beginners - CGI List'"
<beginners-cgi@perl.org>
Sent: Tuesday, December 06, 2005 12:14 PM
Subject: RE: Filering a file
Hello David,
I'm able to open the file, read the contents and output the results of my
initial filtering to a new file.
The problem is that my new file has duplicate entries, and cleaning up
duplicates is where I'm stuck.
Kind regards
Dayo
-----Original Message-----
From: David Dorward,,, [mailto:[EMAIL PROTECTED] On Behalf Of David
Dorward
Sent: Monday, December 05, 2005 2:35 PM
To: 'Perl Beginners - CGI List'
Subject: Re: Filering a file
On Mon, Dec 05, 2005 at 02:20:33PM +0100, Adedayo Adeyeye wrote:
How do I write a script to parse through this file and just return the
unique names. Ie I want the repetitions ignored.
What have you tried? Where are you stuck? (Opening the file? Reading
the contents? The actual filtering?). Nothing in your question is CGI
related, have you got this working as a command line script but are
having trouble converting it to work under CGI? What code have you got
so far?
--
David Dorward http://dorward.me.uk
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>