Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

How to check whether the file is a string (ex. @ test.com). If this is a return one, if not zero.
  • Comment on How to check whether the file is a string

Replies are listed 'Best First'.
Re: How to check whether the file is a string
by CountZero (Bishop) on Nov 12, 2011 at 16:24 UTC
    What is your definition of a "file that is a string"?

    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

Re: How to check whether the file is a string
by Anonymous Monk on Nov 12, 2011 at 09:26 UTC
    What does that mean?

      Maybe the other Anonymous Monk wants to know whether a file contains "text"? -X, especially -T could be of help, except for non-ASCII text.

        You could try the 'file' utility if your OS supports it. It will make a good guess at identifying what is in any file. -- if that's what's needed ;)