On Thu, Jul 12, 2001 at 09:52:32AM +0100, Govinderjit Dhinsa wrote:
> Does any body know why the printf is not printing anything out!
> 
> I tested the rest of the script by replacing the printf line with,
> ##########
> print "$line";
> ##########
> the file prints (with out any changes to the file, as expected). So
> everything else is working apart from the printf.

> foreach $line(@newarray) {
> 
>         $a = substr($_, 0, 18);
>         $b = substr($_, 32, 1);
>         $c = substr($_, 290, 10);
>         printf "%18s %1s %10s\n",$a, $b, $c;
> }

You are iterating with $line, but using $_ in substr.  You need to
select one or the other.

  foreach (@newarray)

or

  $a = substr($line, 0, 18);

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net

Reply via email to