Help for this page

Select Code to Download


  1. or download this
    sub test_a {
       my $var = "Hello World\n";
    ...
    
    test_a();
    print($var);  # Doesn't print Hello World.
    
  2. or download this
    sub test_a {
       local $var = "Hello World\n";
    ...
    
    test_a();
    print($var);  # Doesn't print Hello World.
    
  3. or download this
    sub test {
       $_ = $_[0];
    ...
    
    $ perl script.pl
    Modification of a read-only value attempted at script.pl line 3.
    
  4. or download this
    sub test {
       local $_ = $_[0];
    ...
    A
    B
    C