Stories
Slash Boxes
Comments

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Abigail (26)

Abigail
  (email not shown publicly)

Journal of Abigail (26)

Friday October 06, 2006
04:30 PM

Spot the mistake (solution)

[ #31244 ]

The bug in the program below (beside the spotted $fh = open (...) instead of open ($fh, ...)) lies in in the true-ness of $ebits.

If there are no errors, Perl will set all bits in $ebits to 0. However, a string where all bits are set to 0 is still true. So, hell will be raised even if there are no errors. And if file descriptors 4 and 5 would be in error, it would not raise the alarm.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.