Re: split is not convinient

Mark Seger wrote:

Am I going blind are is the output from all 3 examples above the same?

Yes, because modern versions of perl automagically check for undefined

In any event this discussion caused me to go back and read the
documentation since nobody actually said why you needed 'defined' and
the only explanation I could find is that you can't distinguish between
an undef, 0 or '' in a boolean!

I guess the reason I've been lucky up until now is that when leaving off
the 'defined' and reading a file I can never read in a 0 or '' since
each string will have a \n at the end, but I can also appreciate why
including the 'defined' would be good form even if you know it won't
effect your particular situation - or is there something else I'm
missing here?

Some "text" files may not contain a final newline and if the last
character is "0" the last line read will be false but defined. If the
Input Record Separator is set to the length 1 ($/ = \1;) then any "0"
character read in will be false but defined.

use Perl;