in reply to Checking for blank string

What do you mean by "initialised"?

In your example, it seems the value is the empty string , which is defined. undef is undefined. To check for them, use

# empty string defined $value && '' eq $value # undefined ! defined $value

Check for definedness is needed in the first case, as `undef` stringifies to the empty string.

($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,

Replies are listed 'Best First'.
Re^2: Checking for blank string
by Himaja (Novice) on Sep 26, 2016 at 08:28 UTC

    By initialised, i mean i get a warning saying "Use of uninitialized value $data in string eq at /path with the following code:

    next if ('' eq $data)

      In that case, your $data really is undefined. I would rewrite your statement like this:

      next unless defined $data;

      TIMTOWTDI, of course.