Why is this example not working?
#!/usr/bin/perl
use POSIX qw(strftime);
use Time::Local;
my $date = strftime "%Y-%m-%d", localtime;
my $command = "ls clients/*/ERRORi/" . $date . "/*s";
@result = `$command`;
foreach $group (@result) {
my $file = '/opt/' . $group;
open( my $input_fh, '<', $file) || die "Can't open $file: $!";
print $input_fh;
}
it will return:
Can't open /opt/clients/cli8832/ERRORi/2014-06-25/file.564159972s
: No such file or directory at ./my.pl line 12.
but if I do ls /opt/clients/cli8832/ERRORi/2014-06-25/file.564159972s it works
$filehas a newline in it.