#!/usr/bin/perl -w use strict; use warnings; sub format { local $_ = reverse sprintf "%.*f",2,shift; # 2=Anzahl Nachkommastellen s/(\d{3})(?=\d)(?!\d*\.)/$1,/g; tr/.,/,./; return scalar reverse; } print ":".&format(300000000)."\n";