PERL

PERL 파일 열기 읽기 닫기 삭제

고요한하늘... 2012. 11. 7. 13:47

파일 삭제


if ( -e $output_file ) {
  unlink $output_file or die "cannot remove output file: $!";
}


파일 열기 , 닫기

open(INPUT, $keywords_file) or die "cannot open input file: $!";
close(INPUT);

파일 읽기
while ( <INPUT> ) {
  chomp; $total++;
  my ($unique_id, $named_entity, $clues) = split(/\t/);
 
  #next unless exists $top_persons->{$named_entity};
  $valid++;
  $persons{$named_entity} = [] unless exists $persons{$named_entity};
  push @{$persons{$named_entity}}, { id=>$unique_id, clues=>$clues };
}

'PERL' 카테고리의 다른 글

PERL 기본함수 q, qq qw  (0) 2012.11.07
PERL MAP 사용법  (0) 2012.11.07
PERL SUB 모듈에서 파라미터 받기  (0) 2012.11.07
PERL 옵션 설정  (0) 2012.11.07
PERL 변수 선언 및 특이 표현  (0) 2012.11.07