Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re: Uer Perl Variable in file

by Anonymous Monk
on Aug 06, 2012 at 14:24 UTC ( #985736=note: print w/replies, xml ) Need Help??

in reply to Uer Perl Variable in txt file

I don't feel that I understand what you are getting, based on the snippet of source code that I see ... but here is one important thing to keep in mind: the difference between single and double quotes.

A string such as 'This is $name' will be output literally as it appears, whereas a string in double quotes such as "This is $name" will have the variable-name interpolated.   That is, if $name is Fred, you get:   This is Fred in the second case but not the first.

Replies are listed 'Best First'.
Re^2: Uer Perl Variable in file
by vinaybond (Novice) on Aug 06, 2012 at 14:40 UTC
    I have a file which has contents like this

    I am $name
    I am from $city
    I live $food
    I got $car

    Using perl code I am reading line one by one from file.txt. When I print line using $_ it does not replace variable in text file with variable values in .pl file but it prints the line as it is.
Re^2: Uer Perl Variable in file
by linuxkid (Sexton) on Aug 06, 2012 at 15:40 UTC

    Because this is external data, the interpreter will not interpolate variables


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://985736]
[Discipulus]: infact my tk client is unable to connect at the moment
[ambrus]: choroba: that doesn't matter, the cookies are independent on the webserver, they just have to contain your username and crypted password with a seed of the user's choice, you can change the hostname or even construct a cookie without asking the server
[ambrus]: choroba: and for perlmonks (but not for everything2), you don't even need a cookie, you can just send a username and password parameter in every request, and this is even documented in What XML generators are currently available on PerlMonks?
[holli]: i admire you choroba, if i had to work at such a place, i wouldn't last long. as bosses don't like if someone calls them clueless idiots
[ambrus]: (The cookie format is not documented anywhere afaik, but it's trivial to reverse engineer even without being a pmdev.)

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (9)
As of 2017-10-24 11:27 GMT
Find Nodes?
    Voting Booth?
    My fridge is mostly full of:

    Results (289 votes). Check out past polls.