You may get better marks if you populated a hash with the filename / directory pairs since this could be populated from a configuration file.
my %destinations = qw(
file1 sysbacks
file2 alpha
file3 gamma/blue
file4 gamma/green
file5 gamma/green
);
#later
my $target = "$destinations{$filename}/$filename";
I take your point about making his professor believe it was him. Even this code is too well written for a newbie. Try the following newbie style tips...
- Remove the elsif and hust have a bunch of if statements one after the other.
- Use a regex for the if test but manually assign $_ = $file beforehand.
- chomp the input on the way in.
- Use the $_ explicitly in the print statement with a newline to make up for the chomp!
- Use a different variable to store the name of the output file.