Suppose you have a "test encode" string and a "prova.txt" file you want to encode in Mime base64. To solve the problem we can simply launch the command line:
perl -MMIME::Base64 -e 'print encode_base64("test encode")'
perl -MMIME::Base64 -0777 -ne 'print encode_base64($_)' prova.txt
For the reverse operation just do:
perl -MMIME::Base64 -le 'print decode_base64("string in base64")'
perl -MMIME::Base64 -ne 'print decode_base64($_)' prova.base64