my $NuserDir = new FileHandle "+>> /home/$key"; while (my $fobj = readdir $NuserDir) { next if $fobj eq '.' or $fobj eq '..' or $fobj eq '.profile'; print ("chown -R $key:$euser_group $fobj"); } Can't use an undefined value as a symbol reference at usercfgforfacs.test.plx line 256.