Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!maverick.ksu.ksu.edu!ux1.cso.uiuc.edu!phil From: phil@ux1.cso.uiuc.edu (Phil Howard KA9WGN) Newsgroups: comp.lang.perl Subject: While learning PERL... a suggestion Keywords: perl file learn suggest Message-ID: <1991Jan19.003519.23569@ux1.cso.uiuc.edu> Date: 19 Jan 91 00:35:19 GMT Organization: University of Illinois at Urbana Lines: 25 While learning PERL I have reached the part about the various file test operator. I noted that -B and -T need to read SOME of the file to make their appropriate determinations. I though of another kind of test that could be useful, especially from pipes where the name might not be there. Suggestion: Add a -Z file test operator that returns TRUE if the file appears to be the output of the UNIX compress command. Testing this file with -B would still yield TRUE since a compressed file is a subset of binary files. I've still yet to get through the rest of PERL (probably this weekend) so I don't know yet if it is particularly easy to invoke uncompress -c or zcat to pipe input data back to a PERL script. When reading from a file one can reposition back to the beginning of the file and pass the file descriptor on to zcat as STDIN and read from the pipe instead. But for something already coming in from a pipe, the suggested -Z test would have already taken data out of the pipe. Well I hope I don't have egg all over my face with this suggestion. We shall see. -- --Phil Howard, KA9WGN-- | Individual CHOICE is fundamental to a free society | no matter what the particular issue is all about.