John Ackley wrote:
> thanks to all who replied
>
> down to this
>
> # perl -e "print unlink glob
> '/usr/local/billmax/html/images/day-0020a6-5a9bfc*';"
> 1
>
> but in script
>
> my $oldimage = "/usr/local/billmax/html/images/day-0020a6-5a9bfc*";
> my $files = unlink glob $oldimage;
>
> fails
In the first example glob() is in list context which returns a list of file
names but in the second example glob() is in scalar context which returns only
one file name. You probably want something like this:
for my $file ( glob '/usr/local/billmax/html/images/day-0020a6-5a9bfc*' ) {
unlink $file or warn "Cannot unlink '$file' $!";
}
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>