PDA

View Full Version : Why I like Perl...


$cirisme
May 12th 2003, 01:43 PM
Look at it, isn't it just beautiful:

@top = split(/\%\&\%/, $nav);
@top = grep(/\%\%/, @top);
@top = sort{ $a <=> $b}@top;

:duh:

I used this just last night for some software for the company I'm starting. I love Perl. In those three lines, I did something that could take hundreds of lines in other languages.

:bunny:

John Reece
May 13th 2003, 07:25 AM
Yes, cirisme, that is beautiful.

Brevity = Beauty :smile:

djnoz
May 13th 2003, 08:47 AM
next thing ot do... explain what it means!
:shrug:
either in english or php... both of which I vaguely understand

$cirisme
May 13th 2003, 01:33 PM
Say you have some data like this:

1%%Hello!%&%
0%%Hello World!%&%

It would resort the data based on the 1 and the 0. So, a list would be outputted as

Hello World!
Hello!

...and that is just plain cool. :cool:

djnoz
May 13th 2003, 02:03 PM
In three lines, that's pretty impressive. I can see why you like Perl :smile:

Em7add11
May 13th 2003, 02:08 PM
I'm gonna have to finish reading my Perl book now. I like simple. :smile:

yxboom
May 13th 2003, 02:11 PM
Couldn't you have made that same command with 2 lines in PHP :hrm:

$cirisme
May 13th 2003, 02:23 PM
No, PHP doesn't have grep. :hrm:

In MySql, you can have it in one line, but I am not using MySql. If I was, it would only take 1 line, too.

Without SQl, it would take a ton of code to do the same thing in Php.

yxboom
May 13th 2003, 02:46 PM
Show off.

$cirisme
May 13th 2003, 03:04 PM
You want me to show off some more?

How bout unreadable regexes I wrote myself?

What does this do:

((\w+)\s+(\d+)\:(\d+)\s+(\w+)\s+\[(\w+)\]\s+)

?

:teeth:

yxboom
May 13th 2003, 03:15 PM
It doesn't fix the thread rating in the statistics box :poke:

:teeth:

yxboom
May 13th 2003, 03:21 PM
((\w+)\s+(\d+)\:(\d+)\s+(\w+)\s+\[(\w+)\]\s+)

could be

((\w+) 1+ \: 1+ (\w+) \[(\w+)\] )

to be more readable :huh:

yxboom
May 13th 2003, 03:33 PM
I'm thinking it could work as a time or date stamp. Hot or Cold?

$cirisme
May 13th 2003, 03:35 PM
((\w+)\s+(\d+)\:(\d+)\s+(\w+)\s+\[(\w+)\]\s+)

could be

((\w+) 1+ \: 1+ (\w+) \[(\w+)\] )

to be more readable

Umm, no.

I'm thinking it could work as a time or date stamp. Hot or Cold?

So, you like to vacation in Alaska nowadays? :brow:

yxboom
May 13th 2003, 03:41 PM
Today @ 12:35 PM post located here (http://www.theologyweb.com/forum/showthread.php?s=&postid=95457#post95457)
cirisme:



Umm, no.



So, you like to vacation in Alaska nowadays? :brow:

Actually nah. I just have no idea.

$cirisme
May 13th 2003, 03:44 PM
Okay, the regex is:

((\w+)\s+(\d+)\:(\d+)\s+(\w+)\s+\[(\w+)\]\s+)

The \w is a word(s), \s is spacing, and \d is digits.

So, put it all together and we get what?

((John)\s+(3)\:(16)\s+(For God so loved the world...)\s+\[Translation footers...\]\s+)

:smile:

Shaolin
May 13th 2003, 06:36 PM
umm yeah what he said.... good thing i didnt read this thread sooner... :doh: yx next time ill help u figure it out.... bwaahahaha :lol:

prgmrdave
May 23rd 2003, 05:47 PM
05-13-2003 @ 12:04 PM post located here (http://www.theologyweb.com/forum/showthread.php?s=&postid=95438#post95438)
cirisme:

You want me to show off some more?

How bout unreadable regexes I wrote myself?

What does this do:

((\w+)\s+(\d+)\:(\d+)\s+(\w+)\s+\[(\w+)\]\s+)

?

:teeth:

Cool! regex puzzles! More, more! :teeth: