#!/usr/bin/perl -w use 5.010; use strict; print "\n"; my $zahl = -3.9983629; my $stellen = 3; my $rnd = &roundmy ( $zahl, $stellen ); print "Ergebnis $rnd\n"; sub roundmy { my $za = shift; my $st = shift; $za = abs($za); my $rest = ( $za =~ /.(\d+)$/ ); if ( $1 ) { my $mult = '1'; if ( length($1) > $st ) { for ( 1..$st ) { $mult .= '0' } my $erg = int (($za * $mult) + .5) / $mult; } } } print "\n";