This question is a regular feature in Perl advanced interview questions, be ready to tackle it. Here’s a code snippet to open a file using Perl program:  open(DATA, "
while() {
print "$_";
}
< or r: For read only Access
> or w: For creating, Writing, and Truncating files
>> or a: For writing, appending, and creating files
+< or r+: For reading and writing files
+> or w+: For reading, writing, creating, and truncating files
+>> or a+: For reading, writing, appending, and creating files