Leser: 21
1
2
3
4
5
6
7
8
Ambiguous range in transliteration operator at test14.pl line 7 (#1)
(F) You wrote something like tr/a-z-0// which doesn't mean anything at
all. To include a - character in a transliteration, put it either
first or last. (In the past, tr/a-z-0// was synonymous with
tr/a-y//, which was probably not what you would have expected.)
Uncaught exception from user code:
Ambiguous range in transliteration operator at test14.pl line 7.
1 2 3 4 5 6 7 8 9 10 11 12 13 14
#!/usr/bin/perl -w use strict; use warnings; use diagnostics; my $string = '-12,89'; if (($string =~ tr/[0-9-]//c) > 1) { print "Zuviel Muell drin!\n"; } if ($string =~ /[0-9-]/) { print "Ja, Zahlen und/oder Minus drin!\n"; }