#!/usr/bin/perl use CGI; print"content-type:text/html\n\n"; my $action = new CGI; my $username = $action->param('username'); #my $file = "members.txt"; my $file = "users.txt"; my $old = $file; $found = undef; open(OLD, $file) or die "The file $file could not be found\n"; @data = ; close (OLD); foreach $row(@data){ chomp($row); #my @currentrow = (); @currentrow = split(/\t/, $row); if ($username eq $currentrow[0]){ $found = 1; print $currentrow; } } if (defined($found)) { push(@currentrow, $currentrow); open(NEW, ">users.txt") || die "no!\n"; foreach $n ( 0 .. $#currentrow ) { # loop to print array of lines to new file print NEW $currentrow[$n], "\n"; } close(NEW); exit; } else { print "Sorry. You don't have this member"; exit; }