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

Re: [MacPerl] A doubt of a beginner



At 21:28 +1100 on 30/1/98, Daniele Nencini wrote:
>i read  a text file  containing some fruit names and  a $fruit
>($fruit  is a text into the textfile)
>
>es :                   apple $fruit orange
>
>then i need to print out this data so i put it into a variable
>
>       $string="apple,$fruit,orange";

Is that what you are doing, or are you reading in from the file to the
variable $string directly?

If that's the case, then $string will contain the equivalent of "apple
\$fruit orange", where the "$" character in the text file is actually a "$"
character, not part of the variable $fruit.

Either way, assigning a value to fruit *after* you've set the value of
$string, will not change the value of $string.

Try the pattern-replacement method proposed by another responder... that
will account for the fact that you are looking at a text string, rather
than a string with a variable embedded in it.

Windows 95: n. 32 bit extensions and a graphical shell for a 16 bit patch
to an 8 bit operating system originally coded for a 4 bit microprocessor,
written by a 2 bit company that can't stand 1 bit of competition.
                   http://ucnet.canberra.edu.au/~packrat/windows_sig.html



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch