in reply to Two regex problems (easy)

$line =~ m/\s+([a-zA-Z0-9])$/; print "$1<br>";

You didn't test if it actually matched. In this case, it won't, unless the directory name is only a single character. You might try:

my ($file) = ( $line =~ m/\b([a-zA-Z0-9]+)$/); print "$file<br>" if defined($file);

I'm going to assume that once you look into regex quantifiers, you'll have a much easier time with the second one.