One of the main strengths of the Perl programming language are its powerful text manipulation features. In this assignment, you will put them to use for writing a Perl program that can manage a simplified version of the so-called "browser cookies".
These are the specifications for your Perl program:
1. The file with your program must be named cookiemgr.pl
2. The program must be invoked as:
cookiemgr.pl cookies_file [options]
The program must check that its first argument exists, is a file and is readable. If not, it must print string:
Error: a valid file must be passed as first argument to the standard output, and exit. The first argument is compulsory while the following arguments are optional. The arguments are described in the following.
3. File cookies_file can have any arbitrary name. It must be a file of text with the following format:
a. The file consists of an arbitrary number of lines (including, possibly, zero lines).
b. Each line must contain four fields separated by commas.
c. The four fields are: cookie name, cookie value, hostname and expiry date.
d. The first three fields are strings of arbitrary (yet reasonably limited) length; the characters in these strings can be any of: uppercase letters, lowercase letters, decimal digits, the underscore and the dot.
e. The expiry date field is a string of decimal digits in the so-called Unix epoch format.
The following example is the ultimate specification for the format of file cookies_file: