# No.9 Perl Sample (code key - 2) # File Access: opening a file (ファイルを開いて行ごとに処理する) # Tomonori Nagano # Last Update: January 18, 2008 # # This file is encoded in Unicode (UTF-8). If you see gibberish characters, # please re-encode the file in utf-8. # $fileName = $ARGV[0] ; #@ARGV is an array of command line arguments open(INFILE,">$fileName") or die "Couldn't open the file: $!\n" ; # open $fileName with the name INFILE # File Access modes # < for reading, > for overwriting, and >> for appending while () { # do something with $_ here } close(INFILE);