#!/usr/local/bin/perl5

if ( $#ARGV == -1 ) {
    print "Enter attaching file name: ";
    open(TTY,"</dev/tty");
    $| = 1; $| = 0;
    $ARGV[0] = <TTY>;
}

print "#<text/plain;charset=iso-2022-jp;encoding=7bit\n\n";

foreach ( @ARGV ) {
    /\.[^.]*$/;   $suffix = $&;
    if ($suffix =~ /.gif/i) {
          print "#image/gif [photo] $_\n"
    } elsif ($suffix =~ /.jpg/i) {
          print "#image/jpeg [photo] $_\n"
    } elsif ($suffix =~ /.jpeg/i) {
          print "#image/jpeg [photo] $_\n"
    } elsif ($suffix =~ /.au/i) {
          print "#audio/basic [phone] $_\n"
    } elsif ($suffix =~ /.ps/i) {
          print "#image/postscript [postscript] $_\n"
    } elsif ($suffix =~ /.eps/i) {
          print "#image/postscript [postscript] $_\n"
    } elsif ($suffix =~ /.idraw/i) {
          print "#image/postscript [postscript] $_\n"
    } elsif ($suffix =~ /.out/i) {
          print "#text/plain;charset=iso-2022-jp;encoding=7bit [text] $_\n"
    } elsif ($suffix =~ /.ind/i) {
          print "#text/plain;charset=iso-2022-jp;encoding=7bit [text] $_\n"
    } elsif ($suffix =~ /.txt/i) {
          print "#text/plain;charset=iso-2022-jp;encoding=7bit [text] $_\n"
    } elsif ($suffix =~ /.text/i) {
          print "#text/plain;charset=iso-2022-jp;encoding=7bit [text] $_\n"
    } elsif ($suffix =~ /.html/i) {
          print "#application/html [html] $_\n"
    } 
}
