use strict; use warnings; use utf8; $| = 1; my $arg=shift; $arg='.' if !defined($arg); scan ($arg); sub scan { my $DIR; my $d = shift; print STDERR "DIR: $d\n"; opendir($DIR, $d); my @dir = sort grep { -f $d.'/'.$_} readdir $DIR; map ( scan_single_file ($d.'/'.$_, $_), @dir); rewinddir $DIR; @dir = sort grep { $_ !~ /\.+$/ && -d $d.'/'.$_} readdir $DIR; map ( scan ($d.'/'.$_), @dir); closedir $DIR; } sub scan_single_file { my $fullpath = shift; my $file = shift; print STDERR "FILE: $fullpath\n"; return if $file !~ /\.py/i; open F,"<$fullpath"; binmode F; read F,my $data,-s $fullpath; close F; while ($data=~//sig) { print "$1\n"; } open F,"<$fullpath"; binmode F; while () { s/[\r\n]+//g; } close F; }