Program to display complete information about a file: Perm, inode, acl bits.

#!/usr/bin/perl

use File::stat;
$pwd = (getpwuid($<))[1];
print "$pwd";
                   system "stty -echo";
                   print "Password: ";
                   chomp($word = );
                   print "\n";
                   system "stty echo";

                   if (crypt($word, $pwd) ne $pwd) {
                       print "Sorry...\n";
                   } else {
                       print "ok\n";
                   }
$ret = index("hello this is a test for index","index");
print $ret;
lc("HeLlO");
$str = "\LHeLlO";
print $str;
$len = length("Hello testing...");
print $len;
$filename = "data.txt";
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks) = stat($filename);
@statinfo = stat($filename);
for $val (@statinfo)
	{
		print "$val\n";
	}
                   $sb = stat($filename);
                   printf "File is %s, size is %s, perm %04o, mtime %s\n",$filename, $sb->size, $sb->mode & 07777,scalar localtime $sb->mtime;
$str = "this is sample test";
$str =~ m/sample/g;
$post = pos $str;
print $post;
print quotemeta("this is sample . testing gg :");
split(/,/,'value1,value2');
print "@_";

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s