December 2014
Beginner
888 pages
25h 23m
English

When you finish this chapter, you should understand the following program:
use Cwd;use File::Spec;print cwd, "\n";my $dir = File::Spec->rootdir;chdir $dir;opendir(DIR, $dir) or die $!;my @files=readdir DIR;@files = sort {$a cmp$b} @files;foreach my $file (@files){ print "$file\n" if -r $file;}closedir DIR;chdir $ENV{HOME};print cwd, "\n";
Those migrating from shell (or batch) programming to Perl often expect that a Perl script is like a shell script—just a sequence of UNIX/Linux (or MS-DOS) commands. However, system utilities are not accessed directly in ...