in reply to compare file modification time and current time

stat does not return an object, but a list. To get the mtime from stat, use (stat $file)[9].

But you can do away with stat altogether:

if (-M "rajesh.txt" >= 1) { print "The file was modified more than 1 day ago\n"; }

Replies are listed 'Best First'.
Re^2: compare file modification time and current time
by rovf (Priest) on Feb 23, 2012 at 12:25 UTC
    stat does not return an object, but a list.
    I guess the OP posted only part of his program, and s/he left out use File::stat;, which would cause stat to return an object. Otherwise s/he would have gotten an error message about that.

    -- 
    Ronald Fischer <ynnor@mm.st>