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-20 16:41

Read SICP.

Name: Anonymous 2009-02-20 16:42

I'm trying to remake this(please disregard the name of the blog):
http://frozenvoid.blogspot.com/2008/12/text-case-randomizer.html

Stopped reading there

Name: Anonymous 2009-02-20 16:47

Read HMA My Anus.

Name: Anonymous 2009-02-20 16:53

Read Hax My Anus My Anus?

Name: Anonymous 2009-02-20 16:57

Read Using the Join Map Split Idiom for Idiots and Anus Haxers

Name: Anonymous 2009-02-20 17:07

Read HOP.

Name: Anonymous 2009-02-20 17:12

dau.pl

Name: Anonymous 2009-02-20 17:53

>>3
:(
>>4
>>5
>>6
>>7
Where?
>>8
I just googled it, it doesn't seem to have the feature I want and is for iirsir(or some variation in the order of those letters), just all upper case, all lower, talk like an idiot, etc.
thanks though.

Name: Anonymous 2009-02-20 18:19

oh hell, play around with this

sub randomcase {
    return join '', map { int rand(2) ? lc : uc } split //, shift
}
print randomcase("now fuck off!\n");

Name: Anonymous 2009-02-20 18:39

>>1
return 1; means, return to first line of code right?
Oh god

Name: Anonymous 2009-02-20 18:45

Perl, not PERL

Name: Anonymous 2009-02-20 23:08

>>12
It's the same.

Name: Anonymous 2009-02-20 23:17

>>13
is it?
oh whatever.
i'm off to go write some VISUAL BASIC applications, and maybe a few JAVA SCRIPTs while i'm at it - maybe then i'll finish off that PYTHON book i've been reading lately & practice my SCHEME.

Name: Anonymous 2009-02-21 1:16

True. Since OP is already in classes, it's going to be kind of a crunch, but OP needs to play with this shit a lot rather than just doing school work as assigned (also important, of course). CS people are lucky enough to be able to do this, since computers are everywhere and compilers are free. You've got professional facilites available to you. Just imagine needing to purchase thousands of dollars of equipment before you could write a proper program. That's how it is in most fields. You CS kids don't know how good you have it.
 
 OP, I want to see you reading at least one CS paper per week, and learning every living language you hear about well enough to read it. You can study the history of programming in your spare time. If you care about being successful in the field (not just grinding out programs that work often enough to get okayed for deployment, but writing good programs), this is what you'll be doing.
 
 You have no idea how often I'm talking to a CS major and find myself delivering a lecture rather than having a discussion. You and your peers are fucking clueless, and it's all your fault for not reading and not practicing, and above all, not knowing how to consult documentation.

Name: Anonymous 2009-02-21 3:09

>>15
This post looks familiar....

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?

Name: Anonymous 2009-02-21 18:56

>>15
You know that you can design software programs and study computer science without a computer? How do you think the computing pioneers did their initial work?

Name: Anonymous 2009-02-21 18:58

>>17
You don't deserve to work as a programmer if you find three weeks of study using Lisp to be useless. Fucking read SICP for fuck's sake.

Name: Anonymous 2009-02-21 19:02

>>18
Not >>15, but I did write that post. Anyway you can't learn to design good programs without actually putting them into a computer, running them, and modifing them.

Name: Anonymous 2009-02-21 19:08

>>20
it's called mathematics

Name: Anonymous 2009-02-21 19:14

>>21
What. How does doing math teach a person to design programs? Algorithms, perhaps.

Name: Haxus the Great 2009-02-21 19:24

Haxus the Great

Name: Anonymous 2011-02-03 7:15

Name: Anonymous 2011-02-04 15:03

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