File I/O
Using files and filesystems
Perl:
It gets confusing.
Read a file
Last updated at 04:20 PM on Monday 12th April, 2010 by Isaac Turner
Open a file for reading and print it out line by line:
my $line;
open(FILE, "file/path");
while($line = <FILE>)
{
print $line;
}
close(FILE);
Comments (0)
Get directory listing
Last updated at 12:48 PM on Thursday 6th September, 2007 by Administrator
opendir(DIR, 'path/to/directory');
my @files = readdir(DIR);
closedir(DIR);
Comments (0)
Create a directory
Last updated at 01:02 PM on Thursday 6th September, 2007 by Administrator
mkdir('directory')
or die('Error making directory');
Comments (0)