Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^2: Replacing with a variable in while loop

by tekio (Novice)
on May 02, 2011 at 00:43 UTC ( [id://902407]=note: print w/replies, xml ) Need Help??


in reply to Re: Replacing with a variable in while loop
in thread Replacing with a variable in while loop

I've tried using both $var and $_, as $_ should represent $var in this example. My question pertains to this example, guess I should have mentioned the first line in the example:
open(VAR, "<theinputfile.txt");
The entire script is well over 500 lines, and the mentioned snippet is an example of where I'm having problems. As well as I could probably loose my job for posting company source code on the Interwebz. I was just wondering why $var (or $_ which is equal to $var in this scenario) is not updating with each iteration of the while loop. I've done similar things with both Pascal and PHP. It just bewilders me why, in the given example, the variable will not update with each iteration of the loop. Obviously, it is because it is being used as a substitution. I was really just trying to understand the logic behind why. I've figured out a solution to the problem, using another method. But I'd still like to know the logic behind, the why.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://902407]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2024-04-24 19:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found