open FILE, "$opt{d}/dfA$opt{j}$opt{h}" || die "cannot open $opt{d}/dfA$opt{j}$opt{h}: $!\n"; while (){ # Duplex or no... $pagestate = "Duplex" if (/^%%.* \*Duplex Duplex.*/ || /^[&l1S/ig || /^[&l2S/ig || /DUPLEX=ON/g); $pagestate = "Simplex" if (/^%%.* \*Duplex None.*/ || /^[&l1S/ig || /DUPLEX=OFF/g); # Page Size $pagesize = "Letter" if (/^%%.* Letter/ || /^[&l2A/ig || /PAPER=LETTER/g); $pagesize = "Legal" if (/^%%.* Legal/ || /^[L3A/ig || /PAPER=LEGAL/g); $pagesize = "Tabloid" if (/^%%.* Tabloid/ || /^[&l2000A/ig || /PAPER=LEDGER/g); # Number of Pages # # Possible postscript flags are: # %%Pages: # # %%Page: # #^M # (%%[Page: #]%%) = ^M $pages = $1 if (/^\(?%%Page\w?: \d+? ?(\d+).*?/); # Number of copies $copies = $1 if (/^%%.* numcopies (\d+).*?/i); $copies = $1 if (/.*QTY=(\d+).*?/); # Document Title $doctitle = $1 if (/^%%Title: (.*)$/); chomp $doctitle; } close FILE;