How to read a file , print content and close file using perl script?

How to read a file , print content and close file using perl script?
#!/usr/local/bin/perl

$file = ‘/etc/passwd’; # Name the file
open(INFO, $file); # Open the file
@lines = <INFO>; # Read it into an array
close(INFO); # Close the file
print @lines;

 



0Shares

Leave a Reply

Your email address will not be published. Required fields are marked *