in reply to Saving PDF files from gmail

Maybe this is a line ending issue (especially if running this on non-Linux/Unix systems).

Try adding ':raw' to the mode in your open call:

open($fh, '>:raw', "$filepath" . "$_->{filename}");

Replies are listed 'Best First'.
Re^2: Saving PDF files from gmail
by anonymonk (Acolyte) on Jun 26, 2015 at 15:58 UTC

    thanks but i figured it out and all i was missing was this binmode($fh);

      FYI, adding :raw to the mode in open has the same effect as using binmode