Janek,
  I tried that originally with the same results.  I am perplexed to why this
is happening, anyone have any ideas?


Thanks
Lance


-----Original Message-----
From: Janek Schleicher [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 30, 2002 8:11 AM
To: [EMAIL PROTECTED]
Subject: RE: Problem reading a file and passing a variable

Lance Prais wrote at Thu, 30 May 2002 01:47:34 +0200:

Perhaps you missed to chomp th $ln.
So $ln = "1-294613112\n" what is perhaps not what you wanted.

> This is the most bizarre thing I have ever seen.  I am using the following
code: There is
> absolutely no reason why this should not return anything when I pass in
the variable.
>
> The text file that it is reading form looks like this: 1-10903223
1-281734170
> 1-294613112
> 1-313763161
> 1-314022306
> 1-330892166
> 1-358488075
>
> The result of the print is as follows:
> --------------> User Id(name):
> --------------> SR(bulk):
> --------------> User Id(name):
> --------------> SR(bulk):
> --------------> User Id(name):
> --------------> SR(bulk):
> --------------> User Id(name):
>
> You can see the there is data but is not being read.
>
> ...
> open BULK, $daily_sr_file or die "Could not open file:$!";
>
> my $line = 1;
>
> while(my $ln = <BULK> ) {
>       $ln =~ s/ //g;

        chomp $ln;   # My suggest

>       #what in the world is this comment?
>       #use the items of the
>       #NOTE: all columns are named
>       my $get_case_text = $dbh->prepare("
>               SELECT
>                       a.sr_num           sr_num,
>                       a.sr_title         sr_title,
>                       a.sr_stat_id       sr_stst_id
>               FROM
>                       s_srv_req  a
>               WHERE   sr_num         = ?"
>       );
>       #just above is the problem should be a ? instead of $ln
>
>       #$sr_num should be $ln
>       $get_case_text->execute($ln) or $dbh->errstr;
>
>       #use hashrefs instead of 17 variables
>       my $case = $get_case_text->fetchrow_hashref();
>       $get_case_text->finish;
>
>       print "--------------> SR(bulk): $case->{sr_num}\n"; print
"--------------> User Id(name):
>       $case->{sr_title}\n"; $line++;
> }
> }
> close(BULK);
> $dbh->disconnect;
>


Best Wishes,
Janek

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to