-2

Use of uninitialized value in string Where is mistake?

else{
    print $q->param('test_name');

    my $age = $q->param('age');

    print "Возраст: $age";

}
Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335
KingOfPing
  • 67
  • 1
  • 2
  • 6

2 Answers2

2

You should include the full error message in your posts.

The following script will output two warnings:

use strict;
use warnings;

print undef;

my $age = undef;

print "Label: $age";

Outputs:

Use of uninitialized value in print at script.pl line 4.
Use of uninitialized value $age in concatenation (.) or string at script.pl line 8.
Label:

As you can observe, if your warning is about an uninitialized value in a print, then test_name is not defined. If it's about an uninitialized value in concatenation, then age is not defined.

Additionally, your warning messages should state the exact line number that it is referring to. Even if you don't understand the precise meaning of a warning, this tells you where to look.

Miller
  • 34,962
  • 4
  • 39
  • 60
0

This error (based on the code you posted) would indicate that there is no parameter being sent to the script named either of test_name or age.

Scott Offen
  • 6,933
  • 3
  • 21
  • 24