Help for this page

Select Code to Download


  1. or download this
    eval { print speak('sheep'), "\n"; };
    print $@ if $@;
    ...
    __END__
    Died at Perl-1.pl line 21.
    foo
    
  2. or download this
    use 5.010_000;
    
    ...
    __END__
    baa
    foo
    
  3. or download this
    BEGIN {
        my %says = (
    ...
            return $says{$animal};
        }
    }
    
  4. or download this
    {
        my $says;
    ...
            return $says->{$animal};
        }
    }
    
  5. or download this
    sub speak {
        my $animal = shift;
    ...
        die unless defined $says->{$animal};
        return $says->{$animal};
    }