#!/usr/bin/perl use strict; use warnings; use 5.010; say "ohne: ".(-6.725/0.025); say "int(): ".int(-6.725/0.025); say "integer(): ".integer(-6.725/0.025); sub integer { my $wert = shift (@_) || 0; return 'FEHLER' if $wert =~ /e\+?\d+$/; return 0 if $wert =~ /e-\d+$/; $wert = $1 if $wert =~ /^(.*?)\./; $wert = 0 if !$wert or $wert == -0; return $wert; }