in reply to Opening files
All this stuff is explained in greater detail in the docs that come with perl, or any perl book.# open a file for reading in the current directory open(FILEHANDLE,"< some_file"); # open a file for reading using the full path (always a good idea) open(FILEHANDLE,"< /home/my_user/some_file"); # open a file for writing open(FILEHANDLE,"> /home/my_user/some_file"); # append to the end of a file open(FILEHANDLE,">> /home/my_user/some_file"); # and it's always a good idea to check for failures ($! contains the e +rror message) open(FILEHANDLE,"< /home/my_user/some_file") || die "Can't read file: +$!"; # be polite and close the file when you're done :) close(FILEHANDLE);
# by the way # read a line from a file $line = <FILEHANDLE>; # write something to a file print FILEHANDLE "some line of text\n";
/\/\averick
|
|---|