Victory Road Archive

You are viewing an archive of Victory Road.

Victory Road closed on January 8, 2018. Thank you for making us a part of your lives since 2006! Please read this thread for details if you missed it.

Technology → Perl helped my homework

Page 1 of 1

1. SpaceMan++ said on May 6, 2009, 08:12:56 PM (-07:00)

Zoroark
288 posts

When I was stuck in the fill-in-the-blanks activity "l___f___l___k___", I used Perl, and it solved my problem.
It is a one-liner in the command line:

Code:
[SpaceMan@sm-laptop ~]$ perl -e "/^l.+f.+l.+k.+$/ and print while <>" /usr/share/dict/words
life-like
lifelike
lifelikeness
lofty-looking
[SpaceMan@sm-laptop ~]$
and the answer is lifelike.

Here is the line-by-line walkthrough,
Code:
perl # perl interpreter
-e # execute code in the next argument
"
  /^l.+f.+l.+k.+$/ # find words that match the blank
  and print # and print matches
  while <> # look through the lines of ARGV[0..n]
"
/usr/share/dict/words # pass the dictionary file
and last time, I used Perl to find rhyming words.

2. Zega said on May 17, 2009, 03:06:55 AM (-07:00)

Linoone
97 posts

What?!? i don't get it...

3. Yoshi648 said on May 17, 2009, 07:35:25 AM (-07:00)

Administrator
3,147 posts

Quote:
Originally Posted by Zega
What?!? i don't get it...
The code ran through his computer's dictionary and found any words that started with an "l", then another character(s), then an "f", then another character(s), then another "i", etc.

l___f___l___k___

4. §ethi Xzon said on May 17, 2009, 03:56:30 PM (-07:00)

Floatzel
150 posts

Neither do I.... but thats what you get when you try to read a programming language you don't know. Unless it's some form of BASIC, then it's quite easy to understand.

Page 1 of 1

User List - Contact - Privacy Statement - Lycanroc.Net