in reply to Re: global symbol...explict package name
in thread global symbol...explict package name

Hi. You are correct, I want the value of $aOrder->{blah} to go into the array, how would I correct that part? Is it strange how the complaints start with $ODP2Dir and $ODP2Val but not several lines above with $ODP1Dir and $ODP1Val? What's with that? Thank you.
  • Comment on Re^2: global symbol...explict package name

Replies are listed 'Best First'.
Re^3: global symbol...explict package name
by almut (Canon) on Mar 13, 2008 at 03:05 UTC
    I want the value of $aOrder->{blah} to go into the array, how would I correct that part?

    Just get rid of the qw, and put commas between the expressions, i.e.

    my @array1 = ( $aOrder->{rx_OD_Prism_Diopters}, $aOrder->{rx_OD_Prism}, $aOrder->{rx_OD_Prism_Angle_Val}, $aOrder->{rx_OD_Prism2_Diopters}, $aOrder->{rx_OD_Prism2} );
      Hi, I have made the change. Thank you. I have also review all code blocks to make sure everything grouped properly and all was fine. I can't understand why Perl starts complaining at $ODP2Dir and $ODP2Val but not several lines above where I have $ODP1Dir and $ODP1Val. Thank you for your thoughts.
        I have also review all code blocks to make sure everything grouped properly and all was fine.

        Are you sure your code now looks something like this?

        if ($ODP1Dir eq "OUT" || $ODP1Dir eq "DOWN") { if (length($ODP1Val) != 0) {$ODP1Val = '-' . $ODP1Val;} if ($ODP1Dir eq "OUT") { $ODP1Dir = "IN"; } else { $ODP1Dir = "UP"; } }

        Note also that you need eq instead of == to do a string comparison...