in reply to read/write perl variables to/from file

These are probably to most used file read/write constructs.
# Read the total content of a file. With or without '<' open(FIL,"<$filename") || die "Cannot open $filename for reading: $!"; my @data = <FIL>; close(FIL); # Read a file line by line. Again with or without '<' open(FIL,"<$filename") or die "Cannot open $filename for reading: $!"; while (my $data = <FILE>) { ## statements }; close(FIL); # Create a file and write a line of data. # NOTE: If the file already exists it will be OVERWRITTEN my $data = "A line of text"; open(FIL,">$filename") || die "Cannot create $filename for writing: $! +"; print FILE "$data\n"; close(FIL); # Append a line of data to a file. Creates the file if it does not exi +st. open(FIL,">>$filename") || die "Cannot open $filename for appending: $ +!"; print FILE "$data\n"; close(FIL);