What are the various file operations in perl. Explain with example.
Answer / Preeti Arya
Perl provides various functions to perform file operations, such as opening, reading, writing, appending, and closing files. Opening a file is done using the open() function.nnExample: `open(my $fh, '>', 'example.txt') or die "$!"; print $fh 'Hello World'; close($fh);` This opens the file 'example.txt' in write mode, writes 'Hello World', and then closes it.
| Is This Answer Correct ? | 0 Yes | 0 No |
Suppose an array contains @arraycontent=(‘ab’, ‘cd’, ‘ef’, ‘gh’). How to print all the contents of the given array?
What does perl do in linux?
If EXPR is an arbitrary expression, what is the difference between $Foo::{EXPR} and *{"Foo::".EXPR}?
What are the different ways to run cgi?
How to determine strings length in perl?
What are perl variables?
Explain chomp, chop, cpan, tk.
What are the logical operators used for small scale operations?
What are scalar data and scalar variables?
Explain join function in perl?
Differentiate between arrays and list in perl.
How can you replace the characters from a string and save the number of replacements?