Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

GotToBTru's scratchpad

by GotToBTru (Priest)
on Jun 15, 2010 at 13:25 UTC ( #844863=scratchpad: print w/ replies, xml ) Need Help??

Testing

use Test::Simple tests => 2; ok(1 == 1, 'Identity theorem'); ok( &ask eq 'yep', 'User response test'); sub ask { print "Are you a human?\n"; $answer = <STDIN>; chomp $answer; return($answer); }

For Lady_Aleena

use strict; use warnings; my @dow=('Sun','Mon','Tue','Wed','Thu','Fri','Sat'); my ($laundry_schedule); # initialize vector to 0 # I am setting 8 bits to 0 even tho I only need 7 because # the last argument to vec() must be a power of 2 vec($laundry_schedule,0,8) = 0; # set Wed to 1 vec($laundry_schedule,3,1) = 1; for (my $day; $day <= $#dow; $day++) { printf "Do %s on %s\n",vec($laundry_schedule,$day,1) ? 'laundry' : 'nothing', $dow[$day]; }

For learningpearl

Ways to practice scripting:

  • Convert some task you do manually today into Perl
  • Read thru the questions here, attempt to solve them yourself, learn from discussions
  • Search for programming contests

Link to use as starting point for CSS/JS to color user names to reflect their age relative to me (based on the cb_author id):

CSS to display level

Code code for coding

use strict; use warnings; my $plaintext = 'We are discovered. Flee at once!'; my $key = 'CorrectBatteryHorseStaple'; print "Original message: $plaintext\n"; my $ciphertext = cypher($plaintext,$key); my $represent = $ciphertext; $represent =~ tr/[A-Za-z0-9] /*/c; print " Encoded message: $represent (* indicates non-alphabet characte +r)\n "; my $decoded = cypher($ciphertext,$key); print " Decoded message: $decoded\n"; sub cypher { my $plain = shift; my $key = shift; my $i=0; $key x= ( 1 + length($plain)/length($key) ); return join '', map {$_ ^ substr($key,$i++,1)} (split '',$plain); }
DatePointsPostsRankETA Next RankNext Rank
2010061500InitiateN/AN/A
201407211794154HermitN/AChaplain (1800)
201407231806154Chaplain20141030Deacon(2400)
201410042400203Deacon20141210Curate(3000)
201412103023266Curate20150130Priest(4000)
201503033620326Curate20150422Priest(4000)
201504074000358Priest20150709Vicar(5400)
201504224220381Priest20150711Vicar(5400)
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (9)
As of 2015-05-04 22:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    In my home, the TV remote control is ...









    Results (108 votes), past polls