$num =~ s/(\d{1,3})(?=(?:\d{3}))/$1\./g