#!/usr/bin/perl -w use strict; my $a = undef; print "a=$a\n"; #warning undef var ! $a ||= ""; # $a = $a || ""; print "a=$a\n"; #no warning "" null string my $b= "0"; #gottcha with string of "0" print "b=$b\n"; $b ||= ""; print "b=$b\n"; #sets b to "" (changes "0" to "") my $c = "xyzzy"; $c ||= ""; print "c=$c\n"; #c still "xyzzy" !! my $d = ""; $d ||= "default"; print "d=$d\n"; #d is "default" my %hash; my $e = ""; $hash{'key1'}{'key2'} = $e ||= "--"; print "$hash{'key1'}{'key2'}\n"; #prints "--" __END__ Output: Use of uninitialized value $a in concatenation (.) or string at C:\TEMP\scratch.pl line 5. a= a= b=0 b= c=xyzzy d=default --