note
jsprat
2 is a number, and perl is trying to DWYM with the numerical compare (==). <strike>Try putting
<code>one
two
three
four</code><p />in __DATA__, and </strike><p />change the conditional to <code>if ($data eq '2')</code>. Now see what effect chomp has...<p />
<b>Update:</b> Struck out the data section and added bit about numerical compare to the first sentence. I shouldn't have included the red herring (one, two, three). The original point was supposed to be that perl will treat a variable like a number in numerical context (== instead of eq).
314638
314638