Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

How a script becomes a module

by brian_d_foy (Abbot)
on Oct 05, 2004 at 20:53 UTC ( #396759=perlmeditation: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    #!/usr/bin/perl
    
    ...
        }
        
    print "The high score was $high_score\n";
    
  2. or download this
    #!/usr/bin/perl
    
    ...
        }
        
    print "The high score was $high_score\n";
    
  3. or download this
    #!/usr/bin/perl
    
    ...
        }
        
    print "The high score was $high_score\n";
    
  4. or download this
    #!/usr/bin/perl
    
    ...
    sub last_score { $_[0]->{$_[1]}[-1]          }
    sub game_count { scalar @{ $_[0]->{$_[1]} }  }
    sub score_n    { $_[0]->{$_[1]}[ $_[2] - 1 ] }
    
  5. or download this
    #!/usr/bin/perl
    
    ...
        $sum += score_n( @_, $_ ) foreach ( 1 .. game_count( @_ ) );
        $sum;
        }
    
  6. or download this
    sub stats
        {                
        @{ $_[0] }{ qw(name sum average last) } = 
            ( $_[1], &sum, &average, &last_score );
        }
    
  7. or download this
    #!/usr/bin/perl
    
    ...
            
        \%hash;
        }
    
  8. or download this
    #!/usr/bin/perl
    
    ...
        }
    
    sub high_score { ... }
    
  9. or download this
    package Local::Scores;
    use DBM::Deep;
    ...
        }
    
    sub high_score { ... }
    
  10. or download this
    #!/usr/bin/perl
    
    ...
        {
        $modules->{$elem->[0]} = $elem->[1];
        }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://396759]
Approved by kutsu
Front-paged by kutsu
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (11)
As of 2015-07-28 18:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (258 votes), past polls