Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Random F%^k up strings!

by marinersk (Priest)
on May 21, 2017 at 04:08 UTC ( [id://1190780]=note: print w/replies, xml ) Need Help??

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]
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1190780]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2024-04-25 22:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found