Languages and Scripting
Showing results for 
Search instead for 
Do you mean 

Returning file modified time as Blank -- why??

Occasional Contributor

Returning file modified time as Blank -- why??

I am trying to find the difference of system time and file last modified time(current_mtime -> calculated through stat command) for the searched files . But it is returning mtime as Blank(null value)for each searched files. Please help me, where i am making the mistake in this script

my $dir_path;
my $cmd;
my $buf;
use strict;
use File::Find;
use File::stat;
my $current_mtime;

$cmd="ll $dir_path > result";

my @temp;
push @temp , split(/\s+/,$buf);
if ( $temp[8] =~ m/^mdc/i )
# Printing filename , Time and Date
print "\nFile $temp[8] last modified on $temp[7] $temp[6]\n";

find(\&syswanted, '$temp[8]');

# $now is current system unix time
my $now;
$now=`date '+%s'`;
print "\n Now : $now \n";
my $t;

#print "MTime: $current_mtime\n";

print " Diff in minutes is: $t \n\n";


sub syswanted

my $file = $_;
print "File: $file\n";

$current_mtime = (stat($file))[8];
print "MTime: $current_mtime\n";