fnbase => BASENAME, ver => VERSION
port main.sh to perl