Librenix
Headlines | Linux | Apps | Coding | BSD | Admin | News
Information for Linux System Administration 

No Starch Press has published my Perl One-Liners book!

Up
vote
Down

My Perl One-Liners book was just published by No Starch Press!

Perl one-liners are small and awesome Perl programs that fit in a single line of code. They do one thing really well—like changing line spacing, numbering lines, performing calculations, converting and substituting text, deleting and printing specific lines, parsing logs, editing files in-place, calculating statistics, carrying out system administration tasks, or updating a bunch of files at once. Perl one-liners will make you a shell warrior: what took you minutes (or even hours) to solve will now take you only seconds! read more...
mail this link | permapage | score:9981 | -pkrumins, March 24, 2014

perl1line.txt: A handy Perl script collection

Up
vote
Down

The ultimate goal of the Perl One-Liners Explained article series was to release the perl1line.txt file. Last week I finished the series and now I am happy to announce perl1line.txt - a collection of handy Perl one-liner scripts.

The perl1line.txt file contains over a hundred short Perl one-line scripts for various text processing tasks. The file processing tasks include: changing file spacing, numbering lines, doing calculations, creating strings and arrays, converting and substituting text, selective printing and deleting of certain lines and text filtering and modifications through regular expressions.

The latest version of perl1line.txt is always at:
http://www.catonmat.net/download/perl1line.txt
Enjoy! It took me over 3 years to write all the one-liners down. read more...
mail this link | permapage | score:9520 | -pkrumins, November 21, 2011

Perl One-Liners Explained: Handy Regular Expressions

Up
vote
Down

This is the seventh part of a nine-part article on Perl one-liners.

Perl one-liners are short programs that do one and only one task well and they fit on a single line in the shell.

Perl is not Perl without regular expressions, therefore in this part I come up with and explain various Perl regular expressions. Please see part one for the introduction of the series.

This part explains the following regular expressions:
  • Match something that looks like an IP address.
  • Test if a number is in range 0-255
  • Match an IP address
  • Check if the string looks like an email address
  • Check if the string is a decimal number
  • Check if a word appears twice in the string
  • Increase all numbers by one in the string
  • Extract HTTP User-Agent string from the HTTP headers
  • Match printable ASCII characters
  • Match text between two HTML tags
  • Replace all bold tags with strong tag
  • Extract all matches from a regular expression
read more...
mail this link | permapage | score:9497 | -pkrumins, November 11, 2011

Introduction to Perl one-liners

Up
vote
Down

Perl one-liners are small and awesome Perl programs that fit in a single line of code and they do one thing really well. These things include changing line spacing, numbering lines, doing calculations, converting and substituting text, deleting and printing certain lines, parsing logs, editing files in-place, doing statistics, carrying out system administration tasks, updating a bunch of files at once, and many more. Perl one-liners will make you the shell warrior. Anything that took you minutes to solve, will now take you seconds! read more...
mail this link | permapage | score:9431 | -pkrumins, May 28, 2012

perl dispatch table examples

Up
vote
Down

Dispatch Table: The fancy name for a hash of code-refs...
In perl, code is a first class data type... you can talk about it in the same way you would talk about arrays or hashes, you can take references to them (giving you a code-ref ) and you can de-reference them (which runs the code);

Code-references are just scalars that refers to something, and you get them by using the reference-to operator:
read more...
permapage | score:9264 | -f00li5h, December 17, 2010

E-book: Perl One-Liners Explained

Up
vote
Down

I'm happy to announce my 3rd e-book called "Perl One-Liners Explained."

Perl one-liners are small and awesome Perl programs that fit in a single line of code and they do one thing really well. These things include changing line spacing, numbering lines, doing calculations, converting and substituting text, deleting and printing certain lines, parsing logs, editing files in-place, doing statistics, carrying out system administration tasks, updating a bunch of files at once, and many more.

Here is an example. Suppose you quickly need to generate a random, 8 character password. You can do it quickly with this Perl one-liner:

perl -le 'print map { ("a".."z")[rand 26] } 1..8'

Overall, the e-book has 111 pages and it explains 130 unique one-liners. Many of one-liners are presented in several different ways so the total number of one-liners in the book is over 200. read more...
mail this link | permapage | score:9230 | -pkrumins, February 4, 2012

Perl tips

Up
vote
Down

Ten perl one-liner tips and tricks...
The core of any perl one-liner is the -e switch, which lets you pass a snippet of code on the command-line:

perl -e 'print "hi\n"' prints "hi" to the console.

The second standard trick to perl one-liners are the -n and -p flags. Both of these make perl put an implicit loop around your program, running it once for each line of input, with the line in the $_ variable. -p also adds an implicit print at the end of each iteration.
read more...
mail this link | permapage | score:8663 | -Ray, June 1, 2010

Perl: Build a wireless network sniffer

Up
vote
Down

This article reviews common issues of wireless security, and shows how to use open source software to suss out wireless networks, get information about them, and start recognizing common security problems. You will learn how build a lightweight wireless sniffer that runs on open source software and see how simple it is to interact with wireless networks. read more...
permapage | score:8196 | -solrac, January 18, 2005

Book Review: Perl Debugger Pocket Reference

Up
vote
Down

This handy book will only cost you about $10...
One of the most useful methods of checking Perl code, though, is the Perl debugger. Despite the usefulness of this tool, most Perl programmers (including me) never use it. There are a few reasons why we don't use the Perl debugger — we don't know how to use it or feel like learning how to use it is one reason. As part of O'Reilly's monograph (aka Pocket Reference) series, they've recently released a small book on the subject called Perl Debugger Pocket Reference, written by Richard Foley. Although it's small, the book simplifies getting started with the debugger and the price makes it affordable.
read more...
mail this link | permapage | score:7830 | -Ray, April 21, 2004

Perl: Delicious DBIx::Class::Candy

Up
vote
Down

The first in a series of articles covering interesting tools that make programming perl easier on the fingers and even on the eyes ...

This article covers using DBIx::Class::Candy to define and deploy a simple schema with next to no effort

(here are some fine art posters) read more...
permapage | score:7757 | -f00li5h, February 22, 2011 (Updated: April 24, 2012)

Perl for the Sysadmin

Up
vote
Down

There are a lot of useful one-liners in this one.
Using perl -e allows you to specify a script right on the command line. It's a powerful, underused feature even for people who use Perl regularly. Perl's powerful command line options make it a more flexible replacement for sed, awk, and even vi. Combine perl -e with the command line editing capability of modern shells and you can, write, test, and debug in record time.

The -p option tells Perl to act as a stream editor similar to sed and awk.
read more...
mail this link | permapage | score:7740 | -Ray, March 23, 2006

Mosaic movies with Perl, ImageMagick, MPlayer

Up
vote
Down

Take a break and have some fun this summer using Perl, ImageMagick, and MPlayer to create mosaic movies. Zoom out from the center of a large text-overlay image made up of sequential frames of existing movies. Disassemble, composite, and encode your own mosaic-type movies for special promotional or home video events. read more...
permapage | score:7731 | -solrac, July 13, 2006

Perl: The Duct Tape of the Internet

Up
vote
Down

An introduction to Perl programming complete with snippets of code.
When you’re a Perl programmer, you never fret about those little ugly tasks that creep up. Perl can deal with file wrangling, text manipulation, and process management in a way unequaled by any other single language, whether open source or proprietary.
read more...
permapage | score:7721 | -Ray, January 2, 2003

Tutorial: Fast Perl Scripts with SpeedyCGI on Debian

Up
vote
Down

This tutorial shows how to install and use SpeedyCGI (also known as PersistentPerl) on a Debian Etch system. SpeedyCGI is a way to run Perl scripts persistently, which can make them run much more quickly. It keeps the Perl interpreter running, and during subsequent runs, this interpreter is used to handle new executions instead of starting a new Perl interpreter each time. read more...
permapage | score:7664 | -falko, September 14, 2007

Perl: Understanding the Command Line

Up
vote
Down

Perl from the shell...
In past columns, I've talked a lot about the Perl language, but have never said much about perl at the Unix shell command line. So, let's fix that by looking at some commonly used command-line constructs for Perl.

Let's take the simplest invocation:

perl my-script

This invokes my-script, using the relative or absolute path to the script as given, thus not using the PATH in any way...
read more...
permapage | score:7642 | -Ray, February 22, 2005

Perl 6 Introduction

Up
vote
Down

This article describes Perl 6 and includes substantial background on Perl 5.
The de facto OO technique in Perl 5 is blessing a hash and accessing the hash's members directly as attributes. This is quick and easy, but it has encapsulation, substitutability, and namespace clashing problems. Those problems all have solutions: witness several competing CPAN modules that solve them.

Perl 6 instead provides opaque objects by default, with language support for creating classes and instances and declaring class and instance attributes. It also provides multiple ways to customize class and object behavior, from instantiation to destruction.
read more...
mail this link | permapage | score:7589 | -Ray, January 16, 2006

Set up an HA load balancer with Perlbal, Heartbeat

Up
vote
Down

This article explains how to set up a two-node load balancer in an active/passive configuration with Perlbal and heartbeat on Debian Etch. The load balancer sits between the user and two (or more) backend Apache web servers that hold the same content. Not only does the load balancer distribute the requests to the two backend Apache servers, it also checks the health of the backend servers. If one of them is down, all requests will automatically be redirected to the remaining backend server. In addition to that, the two load balancer nodes monitor each other using heartbeat, and if the master fails, the slave becomes the master, which means the users will not notice any disruption of the service. Perlbal is session-aware, which means you can use it with any web application that makes use of sessions (such as forums, shopping carts, etc.). read more...
mail this link | permapage | score:7457 | -falko, January 13, 2009

Book review: Computer Science and Perl Programming

Up
vote
Down

Forty dollars will get you Perl coders a solid book.
The writing in this book is simply good: clear, accurate, intellectually coherent, and warm without being too cute. More than that, it's important — if you work with Perl, each of these articles illuminates at least one of the ideas you're likely to need in your own programming.
read more...
permapage | score:7432 | -Ray, February 19, 2003

Using MySQL and Perl to maintain web pages

Up
vote
Down

Or, how to automate a website so that almost anyone can maintain pages.
The goal of developing dynamic web pages is not only to reduce code to a minimum, but also to reduce the involvement of technical staff in maintaining the data, especially data that belongs to other departments. With this concept in mind, you should eliminate all flat HTML pages and lift out of CGI scripts all text that is displayed to the user. This should be your goal initially, and your rule eventually, if you want to get out of the text-management business and instead focus on what you enjoy and what you were hired to do: develop software.
read more...
mail this link | permapage | score:7368 | -Ray, February 29, 2004

XForms with Ajax, Java, Perl, and PHP

Up
vote
Down

These easy to understand XForms tips show you how to get the most out of your XForms. In this XForms and Perl tip, you'll learn how to submit an XForms form using POST to a Perl script, and capture the data for later use. This tip shows you how to access the submitted XForms data using a Java servlet. This tip looks at both the XForms and Ajax versions and how to combine the two techniques and in this XForms and PHP tip, you will see how to create a PHP script that can receive and work with XML data submitted by an XForms form. read more...
mail this link | permapage | score:7350 | -solrac, October 17, 2006
More articles...
Abstract Art on stretched canvas

Selected articles

Mono-culture and the .NETwork effect

The Real Microsoft Monopoly

Tutorial: Introduction to Linux files

Beneficial Computer Viruses

Testing the Digital Ocean $5 Cloud Servers with an MMORPG

MiniLesson: An introduction to Linux in ten commands

Shadow.sh: A simple directory shadowing script for Linux

Linux dominates Windows

Apple to Intel move no threat to Linux

How to install Ubuntu Linux on the decTOP SFF computer

The life cycle of a programmer

Microsoft to push unlicensed users to Linux

Missing the point of the Mac Mini

Linux vs. Windows: Why Linux will win

Download: Linux 3D Client for Starship Traders

The Network Computer: An opportunity for Linux

Why software sucks

The Supreme Court is wrong on Copyright Case

Why Programmers are not Software Engineers

Space Tyrant: Multithreading lessons learned on SMP hardware

Apple DIY Repair

Graffiti Server Download Page

The short life and hard times of a Linux virus

VPS: Xen vs. OpenVZ

Space Tyrant: A multiplayer network game for Linux

Space Tyrant: A threaded game server project in C

Hacker Haiku

No, RMS, Linux is not GNU/Linux

Space Tyrant: A threaded C game project: First Code

Programming Language Tradeoffs: 3GL vs 4GL

Librenix T-Shirts and Coffee Mugs!

Scripting: A parallel Linux backup script

Closed Source Linux Distribution Launched

 

Firefox sidebar

Site map

Site info

News feed

Features

Login
(to post)

Search

 
Articles are owned by their authors.   © 2000-2012 Ray Yeargin