If you restructure your message, you'll answer yourself:<br><br><div>> $$parmName has no value. What am I doing wrong?<br><br>> I have 10 program variables namely $parm[1-10]</div><br>Yep, that's what you're doing wrong.<br>
<br>Your code should work. The problem must be earlier. But it's not the best way to go about this anyway. You would be much better off putting those parameters into an array @params and then<br><br><span style="font-family: courier new,monospace;"> for my $param (@params) {</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> my ($hardValue, $replaceValue) = split(/~!~/, $param);</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> $sqlString =~ s/~$hardValue~/$replaceValue/g;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> }</span><br style="font-family: courier new,monospace;"><br>or if you really need to insert them positionally,<br><br><span style="font-family: courier new,monospace;"> for my $param (@params) {</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> if (defined $param) {</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> my ($hardValue, $replaceValue) = split(/~!~/, $param);</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> $sqlString =~ s/~$hardValue~/$replaceValue/g;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> }</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> }</span><br style="font-family: courier new,monospace;"><br>The huge, huge benefit, beyond slightly prettier code, is that you can then put a "use strict;" at the top and find mistakes like the spelling mistake that is probably causing your current problem.<br>
<br><br><div class="gmail_quote">2009/7/28 Peter Loo <span dir="ltr"><<a href="mailto:loopeter@yahoo.com">loopeter@yahoo.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="font-family: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-size: inherit; line-height: inherit; font-size-adjust: inherit; font-stretch: inherit;" valign="top">
<div>Hi All,</div>
<div> </div>
<div>I have done this once before and can't seem to remember how I did it.</div>
<div> </div>
<div>I have 10 program variables namely $parm[1-10]. Then I try to check if they are set using a loop like so:</div>
<div> </div>
<div> for ( my $x = 1; $x <= $maxParm; $x++ ) {<br> my $parmName = "parm" . $x;<br> if ( $$parmName ) {<br> my ($hardValue, $replaceValue) = split(/~!~/, $$parmName);<br> $sqlString =~ s/~$hardValue~/$replaceValue/g;<br>
}<br> }</div>
<div> </div>
<div>$$parmName has no value. What am I doing wrong?</div>
<div> </div>
<div>Thank you all in advance.</div>
<div> </div>
<div>Peter</div></td></tr></tbody></table><br>
<br>_______________________________________________<br>
SanFrancisco-pm mailing list<br>
<a href="mailto:SanFrancisco-pm@pm.org">SanFrancisco-pm@pm.org</a><br>
<a href="http://mail.pm.org/mailman/listinfo/sanfrancisco-pm" target="_blank">http://mail.pm.org/mailman/listinfo/sanfrancisco-pm</a><br>
<br></blockquote></div><br>