Do these changes:
after
@raw_data=<FILE>;
add
chomp(@raw_data);
also, split uses a regex style normally, so
($username, $password) = split(/:/, $user);
don't split the individual fields.
Note chomp(), not chop() .. 2 different operators and you want the first one here.
http://perldoc.perl.org/functions/chomp.html
http://perldoc.perl.org/functions/split.html
Also, due to precedence issues, when checking file open etc, use 'or' not '||' .