troubleshooting Question

Can I use PERL to open and read the header of a file?

Avatar of jray9242
jray9242 asked on
18 Comments4 Solutions531 ViewsLast Modified:
I am using Activestate PERL and compiling to code so people can use it and I am wondering if the following can be done.

1. Can I open a file, read the header to determind what kind of a file it is and validate the extention  for the file?

In other words, before I copy the file myFile.jpg. I would read in the header and validate that it is a '.jpg' file.

I am not even sure how to approch this one.

Thanks for the help and examples.

Join our community to see this answer!
Unlock 4 Answers and 18 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 4 Answers and 18 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros