in reply to undef vs empty string '' from split

You can achieve what (I presume) you want by ensuring there is at least one character following the match:

( $var1, $var2 ) = split( /\s*=\s*(?=.)/, $t_arr[0] );

Note however that if you are hand rolling an .ini file parser, that there area a plethora of modules to do the job on CPAN. See Config::Ini and Config::IniFiles for example.


DWIM is Perl's answer to Gödel

Replies are listed 'Best First'.
Re^2: undef vs empty string '' from split
by chrism01 (Friar) on Jun 21, 2007 at 01:23 UTC
    As it happens, the empty string is easier (simpler code), because it's going to be inserted into an Ingres NOT NULL column and I don't have to check/cvt the value from 'undef'.
    No, this isn't a .ini file parser btw.