#
# Date : 2010. 2. 10
#
###############################################
# Folder Name
$DIR_NAME = ".";
###############################################
@expressions = ( "Hello", "world" );
opendir (DIR, $DIR_NAME) || die "Can't open folder";
@FILE_LIST = readdir DIR;
closedir (DIR);
foreach $filename(@FILE_LIST)
{
if (-f $filename)
{
print $filename."\n";
open (IN_FILE, "<".$filename) || die $!;
while (my $line = <IN_FILE>)
{
foreach $expression(@expressions)
{
if ( $line =~ /$expression/ )
{
print $line;
}
}
}
close (IN_FILE);
}
}
'Coding > Perl 삽질기' 카테고리의 다른 글
자주 쓰는 정규 표현식 (0) | 2010.02.25 |
---|---|
[Perl] Hex2Ascii (0) | 2009.06.16 |
Perl 공부 다시 시작하다. (0) | 2006.10.07 |