Skip to content

Instantly share code, notes, and snippets.

@pradhuman7d1
Created December 6, 2021 11:40
Show Gist options
  • Save pradhuman7d1/85da91fe527906b610e44a132f72ef4a to your computer and use it in GitHub Desktop.
Save pradhuman7d1/85da91fe527906b610e44a132f72ef4a to your computer and use it in GitHub Desktop.
perl-File i/o
Q. What is the use of die keyword?
A. When the program fail to read or write a file then it will kill itself and print the error provided with die keyword.
Q. Perl is used mainly to deal with what files?
A. Perl stands for practical extraction and report language and as the name suggests it is most efficient in handling txt files.
Q. What operations are supported by the file handler of perl?
A. Open and read, open and append, open and write are the common operations supported by perl.
Q. What does <$fh> do?
A. It creates an array like structure and stores each line of text file at seperate indexes.
Q. What is the correct code that helps us to seek to the starting of a txt file?
a. seek @fh, 0, 0;
b. seek $fh, 0, 0;
c. seek @fh, 1, 1;
d. seek $fh, 1, 1;
A. b. seek $fh, 0, 0;
Q. What is the notation used for file read only?
a. <
b. >
c. >>
d. <<
A. a. <
Q. What is append in file handling?
a. Used to edit a file
b. Used to remove text from a file
c. Used to add text to a file
d. Used to replace all text in a file
A. c. Used to add text to a file
Q. What does +< signifies?
a. Open a file to read
b. Open a file to edit
c. Append to a file
d. Delete a file's data
A. b. Open a file to edit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment