Block
Are you looking to get certified in DevOps, SRE and DevSecOps?
DevOps
Get Certified!
SRE
Ahead from others!
DevSecOps
Security is Key
Kubernetes
Tomorow's Platform!

How to Open Directory and read and display all the file using perl

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

Rajesh Kumar
Follow me
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x