<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>Snipplr</title>
<link>http://snipplr.com/popular/language/perl</link>
<description>Recent snippets posted on Snipplr.com</description>
<language>en-us</language>
<pubDate>Wed, 22 May 2013 00:12:49 GMT</pubDate>
<item>
<title>(Perl) Net::FTP to ftp a file - kkindoh</title>
<link>http://snipplr.com/view/514/netftp-to-ftp-a-file/</link>
<description><![CDATA[ <p>Simple way to do ftp from Perl</p> ]]></description>
<pubDate>Wed, 19 Jul 2006 16:21:09 GMT</pubDate>
<guid>http://snipplr.com/view/514/netftp-to-ftp-a-file/</guid>
</item>
<item>
<title>(Perl) FHTML (for TextMate) - rareyman</title>
<link>http://snipplr.com/view/28256/fhtml-for-textmate/</link>
<description><![CDATA[ <p>I modified this excellent Perl script, created by John Watson (http://www.watson-net.com) to be used with TextMate to reformat your HTML for easier readability. Here's how to use it:

1.  In TextMate > Bundles > Bundle Editor > Show Bundle Editor
2.  Create a New Command (I call it "Reformat HTML")
3.  On right pane: **Save: Nothing** : **Command: (insert code)**
4.  Bottom right pane: **Input: Selected Text or Document**
5.  Bottom right pane: **Output: Replace Selected Text**
6.  Settings: Key Equivalent: (whatever you want, I use: Command-Option-Shift-F which matches old school BBEdit)
7.  Scope Selector: text.html</p> ]]></description>
<pubDate>Fri, 12 Feb 2010 16:01:49 GMT</pubDate>
<guid>http://snipplr.com/view/28256/fhtml-for-textmate/</guid>
</item>
<item>
<title>(Perl) Post a snippet (add-on for Smultron) - iblis</title>
<link>http://snipplr.com/view/3462/post-a-snippet-addon-for-smultron/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Sun, 05 Aug 2007 19:15:11 GMT</pubDate>
<guid>http://snipplr.com/view/3462/post-a-snippet-addon-for-smultron/</guid>
</item>
<item>
<title>(Perl) Remove duplicate lines from a text file with Perl - noah</title>
<link>http://snipplr.com/view/3124/remove-duplicate-lines-from-a-text-file-with-perl/</link>
<description><![CDATA[ <p>*[Found at Google Answers.](http://answers.google.com/answers/threadview?id=25196)*

Sometimes I get a big list of things, and some of the things occur multiple times in the same list.  To make the list easier to read, I want to *delete* the duplicate lines.
 
A good example is a list of files that have errors (maybe excerpted from an application sever's log files).  In that case you have a newline-delimited list of file paths,  and depending upon the situation, the same file path might be listed 4 or 5 times or more.  Often, it is useful to have a list of just the files that are faulty, which can be produced by deleting all the duplicate lines.  This script is for filtering just those kinds of list files.

[Of course,](http://xkcd.com/378/ "emacs has a command for that")  for **Emacs** users  [there is a much easier way to remove duplicate lines:](http://everything2.com/title/useful%2520emacs%2520lisp%2520functions "useful emacs lisp functions"), if you have `uniq` installed on your system.

`M-x sort-lines RET C-x h M-x shell-command-on-region RET uniq RET`</p> ]]></description>
<pubDate>Tue, 03 Jul 2007 22:06:34 GMT</pubDate>
<guid>http://snipplr.com/view/3124/remove-duplicate-lines-from-a-text-file-with-perl/</guid>
</item>
<item>
<title>(Perl) DBObject Class - tylerhall</title>
<link>http://snipplr.com/view/22/dbobject-class/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Wed, 30 Nov -0001 00:00:00 GMT</pubDate>
<guid>http://snipplr.com/view/22/dbobject-class/</guid>
</item>
<item>
<title>(Perl) load_file_in_array() - Mazzaroth</title>
<link>http://snipplr.com/view/49227/loadfileinarray/</link>
<description><![CDATA[ <p>Load a text file into an array. Remove all CR/LF.</p> ]]></description>
<pubDate>Sat, 19 Feb 2011 03:30:37 GMT</pubDate>
<guid>http://snipplr.com/view/49227/loadfileinarray/</guid>
</item>
<item>
<title>(Perl) Convert a PDF to text with Perl - noah</title>
<link>http://snipplr.com/view/9963/convert-a-pdf-to-text-with-perl/</link>
<description><![CDATA[ <p>Converts the PDF 'example.pdf' to plain text.

IIRC this only converts the _first_ page of the document, but that can be changed by modifying the argument to getPageContentTree on line 8.  Been a while since I've used this so ymmv.</p> ]]></description>
<pubDate>Fri, 21 Nov 2008 16:24:58 GMT</pubDate>
<guid>http://snipplr.com/view/9963/convert-a-pdf-to-text-with-perl/</guid>
</item>
<item>
<title>(Perl) The Onion's What Do You Think? Scrape to RSS - noah</title>
<link>http://snipplr.com/view/8240/the-onions-what-do-you-think-scrape-to-rss/</link>
<description><![CDATA[ <p>Old and busted but still gets the job done.</p> ]]></description>
<pubDate>Sat, 06 Sep 2008 23:08:32 GMT</pubDate>
<guid>http://snipplr.com/view/8240/the-onions-what-do-you-think-scrape-to-rss/</guid>
</item>
<item>
<title>(Perl) Markov Chain Generator - rengber</title>
<link>http://snipplr.com/view/7040/markov-chain-generator/</link>
<description><![CDATA[ <p>My PERL isn't strong enough to get this yet, but I plan on porting to C#. 

Read this: http://en.wikipedia.org/wiki/Markov_chain</p> ]]></description>
<pubDate>Mon, 30 Jun 2008 23:16:39 GMT</pubDate>
<guid>http://snipplr.com/view/7040/markov-chain-generator/</guid>
</item>
<item>
<title>(Perl) shortLink - engel</title>
<link>http://snipplr.com/view/5152/shortlink/</link>
<description><![CDATA[ <p>Easily and quickly shorten URLs from the command line. Utilizes TinyURL and MetaMark APIs.</p> ]]></description>
<pubDate>Thu, 21 Feb 2008 20:26:32 GMT</pubDate>
<guid>http://snipplr.com/view/5152/shortlink/</guid>
</item>
<item>
<title>(Perl) Convert a string to utf8 - eszpee</title>
<link>http://snipplr.com/view/4642/convert-a-string-to-utf8/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Fri, 18 Jan 2008 11:38:07 GMT</pubDate>
<guid>http://snipplr.com/view/4642/convert-a-string-to-utf8/</guid>
</item>
<item>
<title>(Perl) Get user input on the command line. - micmath</title>
<link>http://snipplr.com/view/3405/get-user-input-on-the-command-line/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Fri, 27 Jul 2007 07:56:34 GMT</pubDate>
<guid>http://snipplr.com/view/3405/get-user-input-on-the-command-line/</guid>
</item>
<item>
<title>(Perl) Grab linked files from a list of web pages - noah</title>
<link>http://snipplr.com/view/3126/grab-linked-files-from-a-list-of-web-pages/</link>
<description><![CDATA[ <p>## how to use

`perl grabit.pl urls_for_download.txt`

Expects as argument the name of a file containing a newline-delimited list of URLs:

    http://example.com/coolstuff
    http://example.com/coolstuff/fun
    http://example.com/videos/explosions

When invoked, launches an interactive shell that asks what type of file should be downloaded.  Then downloads all the files that are linked from each of the listed Web pages.

Note that the location of the download folder is hard-coded to `c:/windows/desktop/grabit/` so you may want to change that before trying.

This script is also [available on Github](http://github.com/textarcana/scrapers/blob/643e6e7cb349fa94cbc3fc88e1d55c7b6a262d11/grabit.pl)

## Wait! Do you know about WGet and Curl?

This script is legacy.  People seem to like it (hey, I still use it) but today I would probably not write my own tool to download multiple files off remote sites.

Instead I would likely just use a command-line Web browser like [WGet](http://lifehacker.com/software/top/geek-to-live--mastering-wget-161202.php 'Gina Trapani of Lifehacker, on the way of the WGet ninja') or Curl.  [LWP-Request would also do the trick](http://snipplr.com/view/4063/download-linked-jpegs-from-a-web-page-on-the-command-line/)

## do not comment your code like this!

For a great explanation of the rather baroque commenting style I was using circa 2001, see [Steve Yegge's excellent article on code style: *Portait of a n00b.*](http://steve-yegge.blogspot.com/2008/02/portrait-of-n00b.html)  

Of course, when I sit down to write a Perl script today, I [use POD](http://snipplr.com/view/18611/perl-pod-embedded-documentation-example/) to format and publish my comments.</p> ]]></description>
<pubDate>Tue, 03 Jul 2007 22:31:30 GMT</pubDate>
<guid>http://snipplr.com/view/3126/grab-linked-files-from-a-list-of-web-pages/</guid>
</item>
<item>
<title>(Perl) Write to MySQL database - fugue</title>
<link>http://snipplr.com/view/1879/write-to-mysql-database/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Fri, 29 Dec 2006 01:31:15 GMT</pubDate>
<guid>http://snipplr.com/view/1879/write-to-mysql-database/</guid>
</item>
<item>
<title>(Perl) Read a Whole File - micmath</title>
<link>http://snipplr.com/view/484/read-a-whole-file/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Mon, 17 Jul 2006 15:10:13 GMT</pubDate>
<guid>http://snipplr.com/view/484/read-a-whole-file/</guid>
</item>
<item>
<title>(Perl) How to get screen size - kkindoh</title>
<link>http://snipplr.com/view/292/how-to-get-screen-size/</link>
<description><![CDATA[ <p>Does not work under emacs shell mode</p> ]]></description>
<pubDate>Sat, 08 Jul 2006 21:10:40 GMT</pubDate>
<guid>http://snipplr.com/view/292/how-to-get-screen-size/</guid>
</item>
<item>
<title>(Perl) connect to mysql using a different socket - alfirth</title>
<link>http://snipplr.com/view/52970/connect-to-mysql-using-a-different-socket/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Wed, 04 May 2011 05:44:06 GMT</pubDate>
<guid>http://snipplr.com/view/52970/connect-to-mysql-using-a-different-socket/</guid>
</item>
<item>
<title>(Perl) Text::CSV by hashref - alfirth</title>
<link>http://snipplr.com/view/50024/textcsv-by-hashref/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Fri, 04 Mar 2011 07:31:46 GMT</pubDate>
<guid>http://snipplr.com/view/50024/textcsv-by-hashref/</guid>
</item>
<item>
<title>(Perl) documentation subs - Mazzaroth</title>
<link>http://snipplr.com/view/49225/documentation-subs/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Sat, 19 Feb 2011 03:30:36 GMT</pubDate>
<guid>http://snipplr.com/view/49225/documentation-subs/</guid>
</item>
<item>
<title>(Perl) handle the command line arguments - Mazzaroth</title>
<link>http://snipplr.com/view/49224/handle-the-command-line-arguments/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Sat, 19 Feb 2011 03:30:35 GMT</pubDate>
<guid>http://snipplr.com/view/49224/handle-the-command-line-arguments/</guid>
</item>
<item>
<title>(Perl) pretty-print array - Mazzaroth</title>
<link>http://snipplr.com/view/49223/prettyprint-array/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Sat, 19 Feb 2011 03:30:34 GMT</pubDate>
<guid>http://snipplr.com/view/49223/prettyprint-array/</guid>
</item>
<item>
<title>(Perl) Perl Starter - Mazzaroth</title>
<link>http://snipplr.com/view/49222/perl-starter/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Sat, 19 Feb 2011 03:30:33 GMT</pubDate>
<guid>http://snipplr.com/view/49222/perl-starter/</guid>
</item>
<item>
<title>(Perl) Proxy.pl - bcmoney</title>
<link>http://snipplr.com/view/45551/proxypl/</link>
<description><![CDATA[ <p>Source for handling HTTP requests easily in Perl:
http://stackoverflow.com/questions/134858/whats-the-simplest-way-to-make-a-http-get-request-in-perl

Work with N.Y.Times JSON API in Perl/AJAX:
http://notetodogself.blogspot.com/2009/02/using-jquery-with-nyt-json-api.html

Handling HTTP Requests in Perl:
http://perl.active-venture.com/lib/HTTP/Request/Common.html

Perl CGI Module:
http://www.gossland.com/course/cgi_module/index.html

How to read URL Parameters in Perl:
http://www.webdeveloper.com/forum/showthread.php?p=842109

How to read command-line args in Perl:
http://www.devdaily.com/perl/perl-command-line-arguments-read-args</p> ]]></description>
<pubDate>Fri, 10 Dec 2010 09:22:47 GMT</pubDate>
<guid>http://snipplr.com/view/45551/proxypl/</guid>
</item>
<item>
<title>(Perl) Merge alternate pages from PDFs - iblis</title>
<link>http://snipplr.com/view/36413/merge-alternate-pages-from-pdfs/</link>
<description><![CDATA[ <p>Merges one page of each PDFs after one another into a new PDF file</p> ]]></description>
<pubDate>Mon, 28 Jun 2010 18:37:10 GMT</pubDate>
<guid>http://snipplr.com/view/36413/merge-alternate-pages-from-pdfs/</guid>
</item>
<item>
<title>(Perl) Drush DB backup - jepedo</title>
<link>http://snipplr.com/view/34444/drush-db-backup/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Thu, 13 May 2010 14:33:22 GMT</pubDate>
<guid>http://snipplr.com/view/34444/drush-db-backup/</guid>
</item>
</channel>
</rss>