Perl programming on MPE/iX - April 2002

Solution Symposium Page 18April 4, 2002
opening files with open()
open(HANDLE, "/path/to/file") # open for reading
open(HANDLE, "< /path/to/file") # open for reading
open(HANDLE, "> /path/to/file") # open for writing
open(HANDLE, ">> /path/to/file") # open for appending
open(HANDLE, "| shell command") # open pipe for writing
open(HANDLE, "shell command |") # open pipe for reading
Be very careful when passing user data to open() as a file name!
Hackers know to try using the special metacharacters listed above.