in reply to Counting strings not counting correctly.
my $emd = `date --date '-30 min' +'%H'`; chop ($emd); $emd = "/tmp/pathtomyfiles/$emd.txt";
Probably better to avoid shelling out to /bin/date and use the core POSIX::strftime instead. Also, chomp would be better than chop in your original code.
johngg@shiraz:~/perl/utils > perl -Mstrict -Mwarnings -MPOSIX=strftime + -E ' my $emd = strftime q{/tmp/pathtomyfiles/%H.txt}, localtime( time() - 1800 ); say $emd;' /tmp/pathtomyfiles/10.txt
I hope this is of interest.
Cheers,
JohnGG
|
|---|