Thread: Use:warning

    #1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    31
    Rep Power
    2

    Thumbs up Use:warning


    Hi All,

    I am getting below warnings:


    Use of uninitialized value in string eq at work10_csv.pl line 89,
    Use of uninitialized value in string eq at work10_csv.pl line 93,
    Use of uninitialized value in string eq at work10_csv.pl line 97,
    Use of uninitialized value in string eq at work10_csv.pl line 101,
    Use of uninitialized value in string eq at work10_csv.pl line 105,
    Use of uninitialized value in subtraction (-) at work10_csv.pl line 77,

    And these are the lines of the codes for which I get warnings:

    if($array[3])
    {
    my $first=0;
    my $last=0;
    my $diff=0;
    my $count=0;
    my ($first,$last)=$array[3]=~ /(\d+)\d+)/;
    if($array[0])
    {
    $diff=$last;
    }
    else
    {
    77: $diff= abs ($last-$first);
    }

    89: if($array[2] eq "RO")
    {
    print FILE2 "; access ro";
    }
    93: if($array[2] eq "RO_S")
    {
    print FILE2 "; access ro";
    }
    97: if($array[2] eq "R/W")
    {
    print FILE2 "; access rw";
    }
    101:if($array[2] eq "WO")
    {
    print FILE2 "; access wo";
    }
    105:if($array[2] eq "WO_S")
    {
    print FILE2 "; access wo";
    }
    ______________________________________________________

    Can you please help me to solve these warnings?
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    31
    Rep Power
    2
    Please note that It is like :
    my ($first,$last)=$array[3]=~ /(\d+) : (\d+)/;
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jun 2012
    Location
    Paris area, France
    Posts
    843
    Rep Power
    496
    Check carefully what the content of @array is.

    You don't give enough code to tell you exactly what is goring on,, but quite obviously $array[2] is not initialized, most of the errors are due to that, and $array[1] (and, hence, $last) also not.

    But we can't say much more since you give only a subset of the code.
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    31
    Rep Power
    2
    Originally Posted by Laurent_R
    Check carefully what the content of @array is.

    You don't give enough code to tell you exactly what is goring on,, but quite obviously $array[2] is not initialized, most of the errors are due to that, and $array[1] (and, hence, $last) also not.

    But we can't say much more since you give only a subset of the code.

    Hi Laurent_R,
    Thanks for the reply!
    Actually, I am taking one .csv file as an input and storing all the csv values in an array, so array data can be any, string or number.
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jun 2012
    Location
    Paris area, France
    Posts
    843
    Rep Power
    496
    Then you probably have in your CSV file lines that have less than 4 fields, or possibly empty fields.

    You might need to check if fields are defined.
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    31
    Rep Power
    2
    Originally Posted by Laurent_R
    Then you probably have in your CSV file lines that have less than 4 fields, or possibly empty fields.

    You might need to check if fields are defined.
    Oh yes!
    I guess that is the reason.
    Great, thanks!

IMN logo majestic logo threadwatch logo seochat tools logo