DarkKnightRadick's Journal http://use.perl.org/~DarkKnightRadick/journal/ DarkKnightRadick's use Perl Journal en-us use Perl; is Copyright 1998-2006, Chris Nandor. Stories, comments, journals, and other submissions posted on use Perl; are Copyright their respective owners. 2012-01-25T02:38:17+00:00 pudge pudge@perl.org Technology hourly 1 1970-01-01T00:00+00:00 DarkKnightRadick's Journal http://use.perl.org/images/topics/useperl.gif http://use.perl.org/~DarkKnightRadick/journal/ Some Updated Info http://use.perl.org/~DarkKnightRadick/journal/23116?from=rss <p>Well I'm back to trying to push Perl into my brain, I've got out my Learning Perl book and links to several CD Bookshelves online so I have plenty of resources to go to, I just hope I can sucessfully get past hashes this time. Right now though I'm going to go play some games. Or metamoderate on SlashCode or here on usePerl.</p> DarkKnightRadick 2005-02-10T03:51:13+00:00 journal Not a Lot to Say http://use.perl.org/~DarkKnightRadick/journal/22470?from=rss <p>I've not done much with Perl lately. Been focusing on PHP/MySQL at the moment, although I did write a perl script that calls up a specific fortune file and uses it as a 404 error page. You can't even tell that I'm calling a CGI either, it's fairly cool that way. I'm thinking of using some absolute URLs to spiffy up the error document, perhaps by adding a picture or something.</p><p>I do have a directory full of images that I could also pull up with my script and have displayed. I grabbed them from the Duke3D guys. They have some wacky 404 error images.</p><p>Um, okay, that's it.</p> DarkKnightRadick 2004-12-27T15:32:07+00:00 journal My Tribute to Douglas Adams http://use.perl.org/~DarkKnightRadick/journal/13181?from=rss <tt>#!/usr/bin/perl -w<br>#I have a feeling the answer will be 42<br><br>print "I have a feeling the answer will be the answer to Life! The Universe! And Everything!\n";<br>print "Please input the first number:";<br>chomp($first_num = &lt;stdin&gt;);<br>print "Please input the second number:";<br>chomp($second_num = &lt;stdin&gt;);<br>$answer = $first_num * $second_num;<br><br>if ($answer != 42) {<br>print "$first_num times $second_num is not the answer to Life! The Universe! And Everything! It's actually just $answer\n";<br>} else {<br>print "You know the answer to Life! The Universe! And Everything!\n";<br>}</tt> DarkKnightRadick 2003-07-01T19:18:18+00:00 journal I Write Funny Comments http://use.perl.org/~DarkKnightRadick/journal/13117?from=rss <p>I write funny comments in my Perl programs.</p><p>#!/usr/bin/perl -w<br>#mmmm....pi</p><p>$circumfrence = 2 * 3.141592654;<br>$radius = 12.5;</p><p>print $circumfrence * $radius . "\n";</p><p>#!/usr/bin/perl -w<br>#pi good</p><p>$circumfrence = 2 * 3.141592654;<br>chomp($radius = );</p><p>print $circumfrence * $radius . "\n";</p><p>#!/usr/bin/perl -w<br>#When come back, bring pi</p><p>$circumfrence = 2 * 3.141592654;<br>chomp($radius = );<br>$circle = $circumfrence * $radius;</p><p>if ($radius 0) {<br>print "The radius of the circle is 0\n";<br>} else {<br>print $circle . " is the radius of the cirlce\n";<br>}</p><p>#!/usr/bin/perl -w<br>#I have a feeling the answer will be 42</p><p>print "I have a feeling the answer will be 42!\n";<br>print "Please input the first number:";<br>$first_num =;<br>print "Please input the second number:";<br>$second_num = ;<br>$answer = $first_num * $second_num;</p><p>if ($answer != 42) {<br>print "Actually, the answer is $answer\n";<br>} else {<br>print "See! The answer is 42!\n";<br>}</p><p>#!/usr/bin/perl -w<br>#So, how many towels do you have?</p><p>print "Please enter a word here: ";<br>$name = ;<br>print "Please enter a number here: ";<br>$number = ;<br>print $name x $number;</p><p>#!/usr/bin/perl -w<br>#Hard coded math action!</p><p>print 2 + 3 x 100 * 3 . "\n" . "\t" x2 . 5 * 4 x 20 . "\n";<br>$math = 2 + 3 x 100;<br>$multiply = $math * 3;<br>print $multiply . "\n" . "\t" x 2 . 5 * 4 x 20 . "\n";</p><p>#More Chapter 2 Coding goodness!<br>chomp($name = alex);<br>if ($name gt 'fred') {<br>print "'$name' comes after 'fred in sorted order.\n";<br>} else {<br>print "'$name' does not come after 'fred'.\n";<br>print "Maybe it's the same string, in fact.\n";<br>}</p><p>#Shorter example?<br>$is_bigger = $name gt 'fred';<br>if ($is_bigger) { print "'$name' is greater than 'fred'.\n"; }</p><p>#Doing the opposite!<br>if (! $is_bigger) {<br>print "You idiot, '$name' isn't even close!\n";<br>}</p><p>#taking standard input!<br>$line = ;<br>if ($line eq "\n") {<br>print "That was just a blank line!\n";<br>} else {<br>print "That line of input was: $line";<br>}</p><p>#An example of chomp!</p><p>#Commented out to show refinement<br>#$text = "a line of text\n";<br>#chomp($text);<br>#print $text;</p><p>chomp($text = );<br>print $text;</p><p>#while we were out...<nobr> <wbr></nobr>;)<br>$count = 0;<br>while ($count 10) {<br>$count += 1;<br>print "The count is now $count\n";<br>}</p><p>#undef, you are nothing to me.</p><p>$n = 1;<br>while ($n 10) {<br>$sum += $n;<br>$n +=2;<br>}<br>print "The total was $sum.\n";</p><p>#Lady Madonna, child processes at her feet!<br>$madonna = ;<br>if ( defined($madonna) ) {<br>print "The input was $madonna";<br>} else {<br>print "No input available!\n";<br>}</p><p>Tomorrow I begin Lists and Arrays!</p> DarkKnightRadick 2003-06-28T16:00:48+00:00 journal Why? Because I Could http://use.perl.org/~DarkKnightRadick/journal/12433?from=rss <tt>#!/usr/bin/perl -w<br>#Hard coded math action!<br><br>print 2 + 3 x 100 * 3 . "\n" . "\t" x2 . 5 * 4 x 20 . "\n";<br>$math = 2 + 3 x 100;<br>$multiply = $math * 3;<br>print $multiply . "\n" . "\t" x 2 . 5 * 4 x 20 . "\n";</tt> DarkKnightRadick 2003-05-25T14:25:55+00:00 journal