in reply to Is this bad coding style?
So $_ is compared against "# using "eq" (for strings) and against the integer 1 using "==" (for numbers). Is that a bad style?
Well, it would be much worse style to compare against # using ==, and against 1 using eq :)
It can be a perfectly reasonable means to an end. Whether it's a reasonable means to this end, though, is pretty hard to say. Particularly since there's no end suggested, just a means.
Depending on the end, the above suggestion by bobf could be a better means.
|
|---|