Thread Perl Bug bei int? (44 answers)
Opened by Rolf_PlusW at 2013-03-01 11:29

Gast Gast
 2013-03-02 17:33
#166152 #166152
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use utf8;

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;
}

print integer( 'e-߉' ), "\n";

# 0

Last edited: 2013-03-02 17:35:47 +0100 (CET)

View full thread Perl Bug bei int?