rajeshkumar created the topic: How to Open Directory and read and display all the file using perl
Method 1
$DIR = "/home/rajesh";
$DIRHANDLE = "HANDLE";
opendir ($DIRHANDLE, "$DIR") || die "Error Opening $DIR : $!";
@dirlist = readdir ($DIRHANDLE);
foreach (@dirlist)
{
print "$_ \n";
}
Method 2
@dirlist = `ls -A $DIR`;
foreach (@dirlist)
{
print "$_ \n";
}
Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn
Latest posts by Rajesh Kumar (see all)
- Best AI tools for Software Engineers - November 4, 2024
- Installing Jupyter: Get up and running on your computer - November 2, 2024
- An Introduction of SymOps by SymOps.com - October 30, 2024