How to run a perl script?

They have: 13 posts

Joined: Oct 2006

http://99-bottles-of-beer.net/language-perl-737.html

OK, can someone tell me what to do to set up this script? It's in perl, and uses eye drops...

Abhishek Reddy's picture

He has: 3,348 posts

Joined: Jul 2001

What operating system are you in? Do you have Perl installed?

All you need to do is put the code on that page into a new file (maybe call it 99bottles.pl). Then run perl 99bottles.pl from the command line.

How you go about doing that last bit depends on your OS and what shell you use. Smiling

If you're trying to do this on a server, with hypertext output, then it's slightly different. You'll need CGI on your server -- you'll probably have a "cgi-bin" directory. Add #!/usr/bin/perl -wT as the first line of your 99bottles.pl file, and print "Content-type: text/html\n\n"; as the second line. Put the file in your CGI-enabled directory, and ensure it has the right permissions (755). Finally, visit it in your browser.

The script itself doesn't depend on EyeDrops. It was generated with the help of EyeDrops, and in its presented form works with just Perl. Smiling

Abhishek Reddy's picture

He has: 3,348 posts

Joined: Jul 2001

Here's an expanded version that prints via CGI nicely:

#!/usr/bin/perl -wT

print "Content-type: text/html\n\n";
print "<pre>";

    ''=~(        '(?{'        .('`'        |'%')        .('['        ^'-')
<strong><em>[...snip...]</em></strong>
'`'|('%')).  '++\\$="})'  );$:=('.')^  '~';$~='@'|  '(';$^=')'^  '[';$/='`';

print "</pre>";
'

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.