
Help needed: I cannot seem to get this variable to substitute in this pattern
Quote:
> I cannot seem to get this variable to substitute in this pattern:
> /^$client_prod_list[$b]/
Have you checked to see what that variable actually is, at the time of the
substitution? You could either print it out, or you could check it in the
de{*filter*}.
Quote:
> for($b=0;$b<=$count1;$b++)
Also, as Randal says, "Real Perl programmers don't use subscripts." Unless
you need $b for something, the more Perlian way is something like this:
...although you may wish to choose a better name than $item.
Quote:
> {
> open(PRODUCTFILE, ">> /usr/cmis/cmisx/prodfile") || die "Can't
> open:$!\n";
> while (<>)
almost certainly better to open the file "manually" here, rather than to
use the diamond operator. (That lets you explicitly control the error
message, if the file can't be opened, for example. Since this is being
done within a loop, you could exit the loop early, thereby shielding your
users from a series of error messages.)
Quote:
> {
> if(/^$client_prod_list[$b]/)
It's nicer to those who read and maintain it if you indent your code to
show nesting levels. A programmers' editor will help you to accomplish
this.
expressions, you may want to use string comparisons instead of a
pattern match on this line.
Quote:
> Use of uninitialized value at /usr/cmis/cmisx/cz line 79, <> chunk
> 915. (line 79 is if(/^$client_prod_list[$b]/) )
That happens when you exceed the array bounds (in the for loop). :-)
Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.*-*-*.com/