in reply to Error in quoting?

Do you really have the user name in $_? I would expect either of the following instead:
my $user = shift; # or my ($user) = @_;
Assuming this isn't a transcription typo, that is, I'd print "->$user<-" just to make sure it contains what you think it should contain.