Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Javascript to PERL

Name: JimiHendrix !qHyjmd9XCE 2009-02-20 16:07

sup /prog/,
I was hoping you could help me with perl syntax and code.
I'm trying to remake this(please disregard the name of the blog):
http://frozenvoid.blogspot.com/2008/12/text-case-randomizer.html
into an Xchat scrip by using PERL.
The problem is I don't know PERL, but have been doing some reading and have learned some things so far but hoped asking here would be faster.
Here's the code I copypasted from a script to change text color to rainbow colored and edited somewhat to change it to randomize text:

package IRC::Xchat::TxtcaseRand;

IRC::register("xchat txtcase", "0.1", "", "");

sub txtcase{
    $i=0;
$_=shift@_;
chomp;
s{(.)}{       "\cC" . (($i++%14)+2) . "$1"      }eg;
#$_=$_."\n";
IRC::command ("/say $_");
        return 1;
}


IRC::add_command_handler("case", "IRC::Xchat::TxtcaseRand::txtcase");

my first question:
1. Doesn't $_=shift@_; and chomp; do the same thing?
2. I suppose this > s{(.)}{       "\cC" . (($i++%14)+2) . "$1"      }eg; is what changes the text color, how would I convert function randomcase(text,a){if(isNaN(a)||a>1||a<0){var a=0.5};var res=[];for(var i in text){
if(Math.random()>a){res[i]=text[i].toUpperCase()}else{res[i]=text[i].toLowerCase()}};return res.join("")}
to the syntax that PERL would recognize and replace it in the code?
3.         return 1; means, return to first line of code right?

Name: Anonymous 2009-02-21 18:34

>>15
Are you telling me to read on LISP instead of asking my /prog/ bros for help.
Wasting about 3 weeks of my life to learn about programming when I have no other use for that knowledge?

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List