=head1 NAME Enjoy! Perl Programming - No.30 =head1 SYNOPSIS データの保存 - 固定長ファイルの操作 =head1 DESCRIPTION Perl言語におけるファイル処理。固定長ファイルを操作する。 =head2 固定長ファイルの操作 固定長のレコードを使ってランダムアクセスファイルを実現する には次のようにする。 # [例題30-1] $Format = "A20 A8"; print '-' x 5 . "New file created\n"; open FH, '>no30-1.write.txt' or die "File open error: $!"; print FH pack($Format,"XJR1200",600000); print FH pack($Format,"SRS400",1350000); print FH pack($Format,"XJR400",400000); close FH; print '-' x 5 . "Reading\n"; open FH, 'no30-1.write.txt' or die "File open error: $!"; while (read(FH, $buf, 28)) { ($name, $price) = unpack($Format, $buf); print "Name = [$name] Price = [$price]\n"; } close FH; print '-' x 5 . "Updating\n"; open FH, '+