Thread funktion kompakter schrieben (15 answers)
Opened by mr-sansibar at 2008-01-03 22:02

topeg
 2008-01-04 09:23
#104371 #104371
User since
2006-07-10
2611 Artikel
BenutzerIn

user image
Noch was kürzer ;-)
Code (perl): (dl )
1
2
3
sub work_with_tmp_line {
     return (shift() =~ /(\w+Exception)/)?$1:'No Exception';
}

oder:
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
sub work_with_tmp_line {
       my $typ=join('|',qw(socket 
                           ArrayIndexOutOfBounds
                           NullPointer
                           LockedPin
                           Authentication
                           BusinessService
                           IllegalState
                           NumberFormat
                           NoSuchElement
                           Remote
                           SQL
                           IO
                           FileNotFound));
     return (shift() =~ /((?:$typ)?Exception)/)?$1:'No Exception';
}

View full thread funktion kompakter schrieben