On Wed, Sep 10, 2008 at 10:19 AM, oldyork90 <[EMAIL PROTECTED]> wrote:
> True or false. (Trying to figure out why this would be done with no > assignment). In the following construct, the current value of $/ is > protected by localizing it to the scope of the block. In this block, > the current value of $/ is not changed. > > { > local $/; > # do some things here. The value of $/ is not modified in any of > the code here. > } > > Thank you. > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > http://learn.perl.org/ > > > That is correct, the value of $/ outside the block will be unchanged and protected when local is used inside the block and whether you changed it inside the block or not. Using local and not initializing it will remove the value from outside the block. If you are using warnings, you get a warning though. Try this to get better understanding. print "\$/ is $/one\n"; {local $/ ; print "\$/ is $/two\n"; } print "\$/ is $/three\n";