As this is intended to be a general purpose subroutine, it's a good idea to localise all your variables with
my just in case your calling code uses variables called $out, $type, etc. Then you can put a
use strict; at the top, and still get a clean compile :-).
Another suggested improvement:
my @t=(localtime);
$t[4]++;
$t[5] += 1900;
my $dt=sprintf "%02u/%02u/%02u %02u:%02u:%02u",@t[3,4,5,2,1,0];
though you might want to consider using POSIX::strftime.