Perl programming on mMPE/iX - August 2001

HP World Page 17August 21, 2001
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.