Hi Gary,

What are you expecting to print? I am assuming you want:

dbfield='pickno' field='PICKNO'

If so, you can a) make $fieldno=1, or remove that array slice off so you have:

my ($dbfield,$field)=(split(/:/))[0,$fieldno];

But, since the piece of the split you are looking for doesn't have a value, you
are initializing the $field variable with nothing, hence the error. 

You will see some info on this in 'perldoc -f split'. You are basically trying
to print an undefined value. You can fix this by checking for  the definedness
before printing.

Cheers,
Kevin

On Thu, Apr 26, 2001 at 02:49:41PM +0100, Gary Stainburn 
([EMAIL PROTECTED]) spew-ed forth:
> Hi all, 
> 
> Using the following code:-
> 
> 63 foreach (@fieldmap) {
> 64   my ($dbfield,$field)=(split(/:/))[0,$fieldno];
> 65   print "dbfield='$dbfield' field='$field'\n";
> 66   &addtext($dbfield,$fields{$field}) if ( $field ne '' && \          
>         $fields{$field});
> 67 }
> 
> with the following data:-
> 
> $_ from foreach is 'pickno:PICKNO::'
> $fieldno=2
> 
> I get the following error message:-
> 
> Use of uninitialized value in concatenation (.) at ./import line 65
> 
> When I added the following after line 64, I got printed out what I 
> expected, and the error line number just went up one:-
> 
>   print "$_\n";
> 
> If I remove the line, the error goes away so it is definitely 
> complaining about the print statement, but it looks perfectly fine to 
> me.
> -- 
> Gary Stainburn
>  
> This email does not contain private or confidential material as it
> may be snooped on by interested government parties for unknown
> and undisclosed purposes - Regulation of Investigatory Powers Act, 2000 
>     
> 

-- 
[Writing CGI Applications with Perl - http://perlcgi-book.com]
Seen the city, seen the zoo, traffic light won't let me through.
        -- Phish (Slave to the Traffic Light)

Reply via email to