Q&A

Q1:My open statement keeps failing, and I'm not sure why. What's wrong?
A1: First, check the syntax of the open statement. Make sure you're opening the right filename. Print the name before the open if you need to be sure. If you intend to write to the file, make sure you put a > in front of the filename; you need to. Most importantly, did you check the exit status of open by using open() || die "$!"; syntax? The die message might be very important in helping you find your mistake.
Q2:I'm writing to the file, but nothing seems to go into it. Where's my output going?
A2: Are you sure that the filehandle opened properly? If you used the wrong filename, your data could be going to the wrong file. A common mistake is to open a file for writing ...

Get SAMS Teach Yourself Perl in 24 Hours THIRD EDITION now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.