http://qs321.pair.com?node_id=1166946


in reply to Re^3: archival storage ($/=\)
in thread archival storage

Ah. So it seems on rereading very carefully, I've tripped up on some slight ambiguities in this line:

Setting $/ to a reference to an integer, scalar containing an integer, or scalar that's convertible to an integer will attempt to read records instead of lines, with the maximum record size being the referenced integer.
That should be read as reference to (integer|scalar containing integer|scalar convertible to an integer) and not as (reference to integer|scalar containing an integer|scalar convertible to an integer). It's not talking about scalar values. It's talking about Perl's idea of Scalar variables, a definitional ambiguity for which I should have been prepared as it's peppered through the Perl documentation that way. The "reference to" part covers all three cases in the list, a structural ambiguity that I should have tested out.

So in trying to golf out three characters and testing edge cases insufficiently (IIRC I tested with all alpha text) I ended up with a bug on my arm. Again, if clear but still shortened was the goal I'd have just gone with undef$/, but $/=\-1; is pretty nice. It still comes down to trying to be overly clever. It's a minimal code change to fix it and the code still makes its intended point with or without the bug.

Just please forgive me if I don't patch the hardcopy right away...