in reply to Glob error check giving warning

This will work:
use Modern::Perl; my $dir = 'C:/data'; my $file = glob(($dir . '/books/*.pdf')) // die "no PDF file\n"; say $file;
The // or defined or operator is available since Perl 5.10.

One more hint: use forward slashes in your filepaths: those need not be escaped, even on Windows.

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James