|
hi jeff --
In a message dated 9/27/2006 5:40:02 P.M. Eastern Standard Time,
[EMAIL PROTECTED] writes:
> Does anyone know why the following is happening?
> A solution/workaround would be greatly appreciated! > > > I have a simple perl program which loops through a file, > line by line -- eg: > > open FOO,"..." > while (<FOO>) > { > printf $_; > } > > my file looks like this: > > abc > %abc > abc > > etc. > > When I run the program, it seems as though Perl attempts to replace '%' > with a a variable reference -- for example, the output often looks like this: > > abc > 0bc > abc > > or > > abc > 0.000000000bc > abc > > I've tried replacing '%''s before the printf, but this doesn't work -- > the variable expansion seems to occur when the line is assigned to $_ > > Any thoughts? > > Thanks! Jeff. further to what david wagner has already said, an example:
C:[EMAIL PROTECTED]>perl -we "use strict; $_ = qq(abc%def); printf
$_; printf $_, 99; print $_"
Use of uninitialized value in printf at -e line 1. abc0efabc99efabc%def the ``w'' switch in ``-we'' command invocation turns on warnings -- very
useful.
problem has nothing to do with interpolation of hashes, which don't
interpolate
in any case: just scalars and arrays.
hth -- bill walters
|
_______________________________________________ ActivePerl mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
