> while (<INFILE>) {
> 
>     ($cur_sym, $cur_desc, $usd_unit, $units_usd) =
>     /^([A-Z]{3})\s+([A-Za-z()\s]{28})\s+(\d+\.\d+)\s+(\d+\.\d+)/;
> 
>     # Strip the trailing spaces from $cur_desc
>     StripTSpace($cur_desc);
> 
>     $cur_sym and $started++;
> 
>     printf OUTFILE "%s\,%s\,%s\,%s\,%s\,%s\,%s\n",
> $date, $time, $tz, $cur_sym, $cur_desc, $usd_unit, $units_usd;
> 
>     not $cur_sym and ($started and last) or next;
> 
>     $started or print STDERR "Didn't find a currency line";
> 
> } 

Argh, you've put the print lines in the wrong place again!

This line:

>     $cur_sym and $started++;

doesn't change the flow of things. So putting the print after
it makes no difference than putting it before it.

This line:

>     not $cur_sym and ($started and last) or next;

includes the 'last' and 'next' commands, which change the
flow of things. In particular, this line says, if $cur_sym is
empty (not $cur_sym), then either quit the loop if you had
already started processing currency lines, or skip to the
next line.

Anyhow, put the print statement AFTER that line.

And the STDERR message needs to come OUTSIDE
the loop, ie after the final }.

hth

Reply via email to