<?xml version="1.0" encoding="windows-1252"?>
<node id="622446" title="Re^3: undef vs empty string '' from split" created="2007-06-20 21:39:09" updated="2007-06-20 17:39:09">
<type id="11">
note</type>
<author id="157432">
Joost</author>
<data>
<field name="doctext">
Hmm.. You mean like this:
&lt;c&gt;
#!perl -w
use strict;
$_ = 'event_handler=';
my ($var1, $var2) = split( /=/);
if( !defined($var2) ) {
    print "undefined\n";
}
else {
    print "'$var1' '$var2'\n";
}
&lt;/c&gt;
output:
&lt;c&gt;
'event_handler' ''
&lt;/c&gt;
that &lt;em&gt;does&lt;/em&gt; seem to be inconsistent with the docs. And what's even more confusing is that:
&lt;P&gt;
&lt;c&gt;
#!perl -w
use strict;
$_ = 'event_handler=';
my @arr = split(/=/);
my ($var1, $var2) = @arr;
if( !defined($var2) ) {
    print "undefined\n";
}
else {
    print "'$var1' '$var2'\n";
}
&lt;/c&gt;
output:
&lt;c&gt;
undefined
&lt;/c&gt;
Confirms the docs.
&lt;p&gt;
&lt;b&gt;updated:&lt;/b&gt; added output for perl 5.8.8 / linux
&lt;!-- Node text goes above. Div tags should contain sig only --&gt;
&lt;div class="pmsig"&gt;&lt;div class="pmsig-157432"&gt;
&lt;em&gt;[id://149675|"What should it profit a man, if he should win a flame war, yet lose his cool?"]&lt;/em&gt;

&lt;/div&gt;&lt;/div&gt;</field>
<field name="root_node">
622420</field>
<field name="parent_node">
622438</field>
</data>
</node>
