#!/usr/local/bin/perl use strict; use warnings; use Data::Dumper; my $filename = 'test.txt'; my @array = stat($filename); print Dumper \@array; my $epoch_timestamp = (stat($filename))[9]; my $timestamp = localtime($epoch_timestamp); print "\nEpoch seconds: " . $epoch_timestamp . "\n"; print "Date and time: " . $timestamp . "\n"; statSubRoutine(); sub statSubRoutine { use File::stat; my $timestamp = (stat($filename)->mtime); my $localTimeStamp = localtime($epoch_timestamp); print "\n\$timestamp: " . $timestamp . "\n"; print "\$localTimeStamp: " . $localTimeStamp . "\n"; } __DATA__ $VAR1 = [ 64513, 7741354, 33188, 1, 283683, 6856, 0, 0, 1434028480, 1434028479, 1434028479, 4096, 0 ]; Epoch seconds: 1434028479 Date and time: Thu Jun 11 15:14:39 2015 $timestamp: 1434028479 $localTimeStamp: Thu Jun 11 15:14:39 2015