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
In reply to Re: Counting strings not counting correctly.
by johngg
in thread Counting strings not counting correctly.
by new2perl2016
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |