expo1967 has asked for the
wisdom of the Perl Monks concerning the following question:
at the office I am modifying a PERL CGI script that processes data read from a file selected by the user from an HTML file field.
given the file handle of the opened file in the Perl CGI script is there some way to determine if the data is text or binary ? The old version of the script just deal with CSV type data. Now I need to modify the script to be able to deal with excel spreadsheets. I already have code that can access spreadsheets. Since the file "selected" by the user may be a CSV type of file without a CSV extension I just can't simply look at the filename.
Any ideas on how to determine the file type by testing the data from a read of the open file handle ?