in reply to Re: Solution for your prof
in thread <> diamond Operator

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...

  1. Remove the elsif and hust have a bunch of if statements one after the other.
  2. Use a regex for the if test but manually assign $_ = $file beforehand.
  3. chomp the input on the way in.
  4. Use the $_ explicitly in the print statement with a newline to make up for the chomp!
  5. Use a different variable to store the name of the output file.