in reply to difference b/w undef and empty string

The first doesn't change the value of $a.

There is no difference between the string created by the literals '' and "".

undef is nothing like the empty string. It's a completely different value. Your confusion probably arises from Perl automatic conversion between data types. When you try to use undef as a string, it evaluates to the empty string and issues a warning. When you try to use undef as a number, it evaluates to zero and issues a warning.

The number zero being automatically converted to a string: >perl -wle"my $x = 0; print $x" 0 Undef being automatically converted to a string: >perl -wle"my $x = undef; print $x" Use of uninitialized value in print at -e line 1.