Fix for Perl 5.18

The string should be binary not string if the string is opened as file handler.