[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] An interesting problem...



Mark,

My wild out-of-left field guess: It may be that perl is attempting to
interpolate %i for you, even though you've given it no reason to believe
that the hash %i might exist.  The basic behavior appears to be that 
the second time through, printf only sees three of the format 
specifications.  Two things I might try:

  a) Place the printf format string within single quotes instead of 
     double quotes to prevent interpolation
  b) Explicity specify the precision of %i as %1i, %2i or some such. 


-Charles
 albrecht@gate.net

 Deep Sky Technologies, LaRC
=-=-=-=-=-=

>RO|cwilkey@u.washington.edu|2937|Re: Printer & Modem porters and Web servers
>RO|cwilkey@u.washington.edu|1|2937
>
>Where the first line is what I was expecting and the second
>line is what I got with "%i" in the third location.  The
>interesting thing is that all of the lines have a "1" stuck
>into the position of the "%i".  Any ideas?  Thanks!  Here
>is the program:
>
>#!perl
>#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>#
>#   Routine which returns the list of available mail messages.
>#
>[...]
>
>    for( $i=0; $i<=$msgNumber; $i++ ){
>        printf( "%s|%s|%s|%s\n", $theStatus[$i], $whoFrom[$i], $theLength[$i], $theSubject[$i] );
>        printf( "%s|%s|%i|%s\n", $theStatus[$i], $whoFrom[$i], $theLength[$i], $theSubject[$i] );
>		print "\n";
>        }
>
>    exit( 0 );