in reply to Re: Re: split/map weirdness: empty strings vs undef
in thread split/map weirdness: empty strings vs undef

split can still be used - just specify a negative number for the number of fields. From split documentation:

If LIMIT is specified and positive, splits into no more than that many fields (though it may split into fewer). If LIMIT is unspecified or zero, trailing null fields are stripped (which potential users of "pop" would do well to remember). If LIMIT is negative, it is treated as if an arbitrarily large LIMIT had been specified.

An example (with quoting changes so it will work on Win2K),

C:\>perl -Mstrict -Mwarnings -le "print 'defined!' if defined( (split +/\|/, '2|3|||||', -1)[4]);" defined!

hth...