Berkeley CSUA MOTD:Entry 49806
Berkeley CSUA MOTD
 
WIKI | FAQ | Tech FAQ
http://csua.com/feed/
2025/05/24 [General] UID:1000 Activity:popular
5/24    

1998/1/6 [Computer/SW/Languages/Perl] UID:49806 Activity:nil
1/6     If anyone with any Perl 5.004 fu can explain the following behavior
        coherently, I'd be enlightened
        1) why are the following two different:
                my($result1) = `cp --help 2>&1`;  #problem! scoping?
                   $result2  = `cp --help 2>&1`;  #right behavior
        2) why are the following two different:
                subs HEY {};
                my($sub1) = 'HEY';   #problem! global scoping problem?
                   $sub2  = 'HEY';   #no problem
                &$sub1;
                &$sub2;
        3) by inserting my($_), I get an error that is far remote from
           what Perl really claims to have. Another scoping problem?