snip... my @row = split(/;/, $array[$_]); if ( defined @row ) { $hash{$_} = \@row; } else { print "Empty line at: $_\n"; } snip...