in reply to Moving gmail messages with net::imap::simple

what does

"$filepath"."$_->{filename}"

evaluate to? Is it a real path? You should test to see if open() was successful. Actually you should check the return value of any function you call.