in reply to Get the $main value when use local
As a side note, read perldoc perlvar to find out why as a general rule $a should not be used as a general purpose variable.
Update: all in all your test code may have been written like thus:
#!/usr/bin/perl -l $c='main'; { local $c='sub'; print $c; print $main::c; } print $c; __END__
|
|---|