Thread Aktive sub-Aufrufe finden (26 answers)
Opened by bianca at 2010-11-08 15:41

bianca
 2010-12-20 12:57
#143729 #143729
User since
2009-09-13
6978 Artikel
BenutzerIn

user image
Jo, sieht gut aus. Gute Idee, danke Dir!
Macht sogar einen neuen Fall auch noch richtig.
Das reicht für meinen Bedarf.

Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/perl -w
use strict;
use warnings;

my $suchwort = 'daten';
foreach my $code (
<<'heredoc'
$a = 'b';  # Kommentar mit Suchwort daten
heredoc
,

<<'heredoc'
$a = 'daten';
heredoc
,

<<'heredoc'
#$a = 'daten';
heredoc
,

<<'heredoc'
                 #$a = 'daten';
heredoc
,

<<'heredoc'
print "#".datensub()."/n"; # Sonderfall, der muss nicht richtig matchen!
heredoc
,

) {
    my $quoted = quotemeta $suchwort;
    if ($code =~ m/$quoted/) {
        print $code . "matcht und ist " . ($code =~ m/^\s*\#/ ? 'auskommentiert' : 'aktiv') . "\n\n\n\n";
    }
}
10 print "Hallo"
20 goto 10

View full thread Aktive sub-Aufrufe finden