My program is only opening the first file, and fails for
every file after that. What's wrong???
Almost certainly, it's because you're not using glob()
correctly. Recall that glob() returns undef after it has
cycled through all possible expansions of its argument. If there's
only one possible expansion, it will return undef on the 2nd attempt.
The best idea for this homework is to use glob() no more
than once in your entire program:
print "Enter a user name:\n";
chomp ($user = <STDIN>);
($dir) = glob("~$user/");
#now use $dir throughout your file. Never call glob again