Show me an example of the variable $user_remove contains.
If it has just the username (and that's the sufficient match criterion), then you can check if it's the last word on $line:
Code:
$line =~ /\b$user_remove$/
# \b = word boundary
# $user_remove = the username
# $ = end of line
or if it's preceded by a backslash:
Code:
$line =~ /\\$user_remove$/
or, and that would be better, check if the second field equals the username without resorting to regexp:
Code:
my ($domain,$username) = split '\', $line;
if ($user_remove eq $username) { ... }
Bookmarks