in reply to Re: Assigning variables and persistence using Lib::LibXML::Reader
in thread Assigning variables and persistence using Lib::LibXML::Reader

If so, declare your variable(s) before the loop, outside the loop's body.

If he doesn' use strict, the undeclared variable $price is a package global and will persist after the loop, carrying the value of the last assignment:

# look ma, no strict for (1..4) { $price = $_; } print $price,$/ __END__ 4
perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'