"Use of uninitialized value in subtraction (-) at ./test3.pl line 30. Use of uninitialized value in subtraction (-) at ./test3.pl line 31. Month '-1' out of range 0..11 at ./test3.pl line 35" #### #!/usr/bin/perl use strict; use warnings; use Time::Local; #use Time::gmtime; my $inputfile = "/home/vdelaney/test.txt"; my $inputmodfile = "/home/vdelaney/test_mod.txt"; my $outputfile = "/home/vdelaney/test_out.txt"; system("cat \"$inputfile\" | awk '{print \$2}'| awk -F 'T' '{print \$1}' > $inputmodfile"); my $seventh_days= 7 * 24 * 60 * 60; print " seventh_day from today=$seventh_days\n"; my ($old_day, $old_month, $old_year) = (localtime(time - $seventh_days))[3..5]; #print "old_day=$old_day ,old_month= $old_month,old_year= $old_year \n"; my $cutoff = sprintf('%04d-%02d-%02d', $old_year + 1900, $old_month + 1, $old_day); print "cutoff date=$cutoff\n"; open my $handle, '<', $inputmodfile; chomp(my @lines = <$handle>); close $handle; #print "List of lines that have dates older than the cutoff date\n"; my ($yyyy, $mm, $dd); my $epoch_seconds; my $strings; for my $date (@lines) { #### ($yyyy, $mm, $dd) = ($date =~ /(\d+)-(\d+)-(\d+)/); $epoch_seconds = timelocal(0, 0, 0, $dd, $mm, $yyyy-1900); $strings = localtime($epoch_seconds); #### print "$date : $epoch_seconds\n" if $date lt $cutoff; }