jesuashok has asked for the wisdom of the Perl Monks concerning the following question:
Dear monks,
When I executed the below code, I found that the variable which is being used in a separate block with the scope 'local' is not being able to use outside the block.
Please check how the '$x' is being used in the below code.
Output :-#!/usr/bin/perl -w $x = "123 56"; $x =~ / /g; print "$x, ", pos($x), "\n"; { local $x } print "$x, ", pos($x), "\n";
what does the 'pos' do with '$x' ?123 56, 4 Use of uninitialized value in print at l.pl line 5. 123 56,
"Keep pouring your ideas"
2006-10-08 Unapproved by planetscape once evidence of habitual plagiarism uncovered.
Back to
Seekers of Perl Wisdom