I've been writing Perl for 17 years and I'm still learning new and better ways to write code. Here's another way based on
kcott's excellent answer below.
#!/usr/bin/perl -w
use strict;
use autodie;
my ($user_file, $changed_file) = qw{test.txt test.txt.mod};
open my $in_fh, '<', $user_file;
open my $out_fh, '>', $changed_file;
print "Which user? ";
my $user = <STDIN>;
chomp $user;
print $out_fh grep !/^$user,/, <$in_fh>;
This one slurps the whole file with the angle brackets, passes it through grep to filter the output which gets printed to the output file. Note the exclamation mark in front of the regex. It's the "not" operator which says you
don't want the matching lines in your output.
Keep working at it. From the long list of replies, you've certainly piqued the Monks' interest.
Sometimes I can think of 6 impossible LDAP attributes before breakfast.