#!/usr/bin/perl use strict; use warnings; my $file=shift(@ARGV) // '/etc/fstab'; my @date=reverse((localtime(( stat $file )[9] ))[0..5]); $date[0]+=1900; $date[1]+=1; my $timestr=sprintf('%04u-%02u-%02u_%02u:%02u:%02u',@date); print "$timestr\n";