Here is the complete (test) script, its part of a larger script, but this
one fails all by itself.

$fileDir = shift @ARGV;
# $myvar = "srctree.txt";
print "opening file $fileDir\n";
  open (tablehandle, $fileDir) || ($errorcheck2 = "TRUE");
   if ($errorcheck2 eq "TRUE")
    {
     print mainlog "ERROR \- data table $table$data_ext missing for
validation\n";
     $error_flag = "TRUE";
    }
   $filerowcount = 0;
   binmode tablehande;
   while (<tablehandle>)
#  until (eof (tablehandle)==1)
    {
    $tableline = $_;
 #  $tableline = <tablehandle>;
      $filerowcount ++;
    print "$tableline\n";
     print "current count = $filerowcount\n";
}
close (tablehandle);
print "total count $filerowcount\n";


Also,

Here is part of the file to be processed.

DUKENRESOURCE_TYPE     01/01/1940ACCOUNTING          ROLLFORWARD_RPTG
99404Cumultv EOC in Actg Principle Cumultv EORT_GROUPS Accounting
RT_DETAILSRoll Forward Reporting                  4          5
DUKENRESOURCE_TYPE     01/01/1940ACCOUNTING          ROLLFORWARD_RPTG
99405Purchase Accounting Adj.      Purchase ART_GROUPS Accounting
RT_DETAILSRoll Forward Reporting                  4          5
DUKENRESOURCE_TYPE     01/01/1940ACCOUNTING          ROLLFORWARD_RPTG
99406Interacct Transfers (reclassesInteracct RT_GROUPS Accounting
RT_DETAILSRoll Forward Reporting                  4          5
DUKENRESOURCE_TYPE     01/01/1940ACCOUNTING          ROLLFORWARD_RPTG
99407Intercompany Transfers        IntercompaRT_GROUPS Accounting
RT_DETAILSRoll Forward Reporting                  4          5
DUKENRESOURCE_TYPE     01/01/1940ACCOUNTING          ROLLFORWARD_RPTG
99408Add'tInvestment Expenditures  Add'tInveRT_GROUPS Accounting
RT_DETAILSRoll Forward Reporting                  4          5
DUKENRESOURCE_TYPE     01/01/1940ACCOUNTING          ROLLFORWARD_RPTG
99409Add'tInc's in Resv/Accrl Exp. Add'tInc'RT_GROUPS Accounting
RT_DETAILSRoll Forward Reporting                  4          5
DUKENRESOURCE_TYPE     01/01/1940ACCOUNTING          ROLLFORWARD_RPTG
99411Add'tOth Bal Sheet Chn'g      Add'tOth RT_GROUPS Accounting
RT_DETAILSRoll Forward Reporting                  4          5
DUKENRESOURCE_TYPE     01/01/1940ACCOUNTING          ROLLFORWARD_RPTG
99412Add't-Capital Expenditures    Add't-CapiRT_GROUPS Accounting
RT_DETAILSRoll Forward Reporting                  4          5
DUKENRESOURCE_TYPE     01/01/1940ACCOUNTING          ROLLFORWARD_RPTG
99413Add't-Increase in Debt        Add't-IncrRT_GROUPS Accounting
RT_DETAILSRoll Forward Reporting                  4          5
DU

Charlie Anderson
Duke Energy Field Services - IT
303-605-1689


                                                                                       
                         
                      "$Bill Luebkert"                                                 
                         
                      <[EMAIL PROTECTED]        To:       Charlie Anderson <[EMAIL 
PROTECTED]>           
                      .net>                    cc:       [EMAIL PROTECTED]             
 
                                               Subject:  Re: How to strip out EOF 
characters                    
                      02/03/2004 02:30                                                 
                         
                      PM                                                               
                         
                                                                                       
                         
                                                                                       
                         




Charlie Anderson wrote:

> I need to count the number of lines in a series of files for a database
> load validation.  However, some of the files have hex 1A imbedded in the
> middle of the file, so my while loop dies a premature death.  Any
> suggestions on how to proceed would be welcome.  Snip below, TIA,

The binmode should allow you to read any binary data including an
Windoze EOF.  There must be something you're not showing us.  How
about a *complete* failing snippet (small as possible) - you have to
be doing something wrong to come to your conclusion.

> open (tablehandle, $fileDir) || die;
> binmode tablehandle;
> while (<tablehandle>) {
>       $tableline = $_;
>       $filerowcount ++;
> }
> print "total count $filerowcount\n";
> close (tablehandle);

You might also wish to change tablehandle to FH or TH to
eliminate any warnings.

--
  ,-/-  __      _  _         $Bill Luebkert    Mailto:[EMAIL PROTECTED]
 (_/   /  )    // //       DBE Collectibles    Mailto:[EMAIL PROTECTED]
  / ) /--<  o // //      Castle of Medieval Myth & Magic
http://www.todbe.com/
-/-' /___/_<_</_</_    http://dbecoll.tripod.com/ (My Perl/Lakers stuff)







_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to