How to open and read data files with Perl



How to open and read data files with Perl..

Answer / Dhiraj Pratap

In Perl, you can use the open function to open a file for reading. Here's an example:nn``perlnopen(my $file, '<', 'example.txt') or die "Could not open example.txt: $!
";nwhile (<$file>) {n print;n}nclose($file);

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More CGI Perl Interview Questions

Explain chomp, chop, cpan, tk.

1 Answers  


What does the command "use strict" do and why should you use it?

2 Answers   Symphony, TCS,


What happens in dereferencing?

1 Answers  


Is there any way to add two arrays together?

1 Answers  


Explain what is the scalar data and scalar variables in Perl?

1 Answers  


How we can navigate the xml documents?

1 Answers  


Explain goto label, goto name, and goto expr?

1 Answers  


Why should I use the -w argument with my Perl programs?

1 Answers  


What package you use to create a windows services?

1 Answers  


What is the purpose of _package_ literal?

1 Answers  


What can be done for efficient parameter passing in perl?

1 Answers  


What are scalars?

1 Answers  


Categories