J
JDS
The following is not working for me. What I want to do is this- my
cgiparms have a variable Test_1 or Test_2 .... generated depending on
what is chosen on a form. I want to check the value of
$cgiparm::Test_1 or $cgiparm::Test_2 .... to see if it matches a known
value. To do this I tried a simple string substitution, but got errors
during compiling. Any input would be greatly appreciated.
Thanks,
Jai.
1. Did not work:
-----------
#!c:\perl\bin\perl.exe -w
use strict;
my $index=18;
my $Test_18="Another Test";
my $x="Test_$index";
print "$$x\n" # Does not work, I expected it to print "Another Test"
------------
Output:
Can't use string ("Test_18") as a SCALAR ref while "strict refs" in
use at test1
..pl line 8.
2. The following kind of works.
------------
#!c:\perl\bin\perl.exe -w
#use strict;
$index=18;
$Test_18="Another Test";
$x="Test_$index";
print "$$x\n" # kind of works.
------------
Output:
#!c:\perl\bin\perl.exe -w
#use strict;
$index=18;
$Test_18="Another Test";
$x="Test_$index";
print "$$x\n" # Does not work
cgiparms have a variable Test_1 or Test_2 .... generated depending on
what is chosen on a form. I want to check the value of
$cgiparm::Test_1 or $cgiparm::Test_2 .... to see if it matches a known
value. To do this I tried a simple string substitution, but got errors
during compiling. Any input would be greatly appreciated.
Thanks,
Jai.
1. Did not work:
-----------
#!c:\perl\bin\perl.exe -w
use strict;
my $index=18;
my $Test_18="Another Test";
my $x="Test_$index";
print "$$x\n" # Does not work, I expected it to print "Another Test"
------------
Output:
Can't use string ("Test_18") as a SCALAR ref while "strict refs" in
use at test1
..pl line 8.
2. The following kind of works.
------------
#!c:\perl\bin\perl.exe -w
#use strict;
$index=18;
$Test_18="Another Test";
$x="Test_$index";
print "$$x\n" # kind of works.
------------
Output:
#!c:\perl\bin\perl.exe -w
#use strict;
$index=18;
$Test_18="Another Test";
$x="Test_$index";
print "$$x\n" # Does not work