Help for this page

Select Code to Download


  1. or download this
    $randomNumber = int(rand(100)) +1;
    if ($randomNumber < 100 and $randomNumber > 50) {
    ...
        $answer = "WiaNq";
    }
    print "Answer = [$answer]\n";
    
  2. or download this
    S:\PerlMonks>perl scope0.pl
    Answer = [kbNtA]
    ...
    
    S:\PerlMonks>perl scope0.pl
    Answer = [WiaNq]
    
  3. or download this
    #!/usr/bin/perl
    use strict;
    ...
        $answer = "WiaNq";
    }
    print "Answer = [$answer]\n";
    
  4. or download this
    S:\PerlMonks>perl scope2.pl
    Global symbol "$randomNumber" requires explicit package name at scope2
    +.pl line 5.
    ...
    Execution of scope2.pl aborted due to compilation errors.
    
    S:\PerlMonks>
    
  5. or download this
    #!/usr/bin/perl
    use strict;
    ...
        $answer = "WiaNq";
    }
    print "Answer = [$answer]\n";
    
  6. or download this
    S:\Steve\Dev\PerlMonks\P-2017-05-20@2349-Variable-Scope-Failure>perl s
    +cope3.pl
    Answer = [WiaNq]
    ...
    
    S:\Steve\Dev\PerlMonks\P-2017-05-20@2349-Variable-Scope-Failure>perl s
    +cope3.pl
    Answer = [kbNtA]