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

Pages: 1-

trying to learn perl 5

Name: Anonymous 2011-03-28 23:04

Where do I start? Should I start with 6?

All I want is a little script of randomness, and move on to more important things!

Name: Anonymous 2011-03-28 23:07

nevermind i figured it out

Name: Anonymous 2011-03-28 23:17

NO EXCEPTIONS

Name: Anonymous 2011-03-28 23:40

Perl 6 isn't even out and it's not coming out any time soon either.

Name: Anonymous 2011-03-29 2:05

#!/usr/bin/perl
rand();


If this is incorrect it's because I've never actually written any perl

Name: Anonymous 2011-03-29 14:52

I gave up and wrote it in FIOC
#!/usr/bin/python
import sys, random
class r:
  def __init__(self,args):
    arglist=args[2:]
    r = int(args[1])
    if ( r > len(arglist)-1 ): sys.exit('wtf')
    x = []
    [[ x.append(arglist.pop(random.randint(0,len(arglist)-1))) for null in range(0,r) ]]
    print '\n'.join(x)

if __name__=="__main__": x=r(sys.argv)

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