SpamAssassin: Welcome to SpamAssassin
Perl Hash Howto
This how-to comes with no guaratees other than the fact that these code segments were copy/pasted from code that I wrote and ran successfully. Initialize a hash Assigning an empty list is the fastest way. Solution my %hash = (); Initialize a hash reference For a hash reference (aka hash_ref or href), assign a reference to an empty hash. my $hash_ref = {}; # ref will return HASH The great thing about this is that if before performing an actual assignment, you want to determine (using the ref operator) the type of thingy that a reference is pointing to, you can!... Note If you treat the variable just as any scalar variable; and use the my declaration alone, or assign a value, ref will return the empty string. my $hash_ref; # not a hash ref!... Clear (or empty) a hash If you literally want to empty the contents of a hash: for (keys %hash) { delete $hash{$_}; } Clear (or empty) a hash reference for (keys %$href) { delete $href->{$_}; } Example #! Output Add a key/value pair to a hash Hash: Hash reference: Hi!
Robert's Perl Tutorial
A basic Perl course primarily for use on Win32 platforms. It assumes that the reader knows nothing of programming whatsoever, but needs a solid grounding for further work. After you finish this course you'll be ready to specialise in CGI, sysadmin or whatever you want to do with Perl. What you need to know You need to be able to differentiate between a PC and a toaster. You do need to exercise the brain cells, and you need time. What you need to have A PC which can run a Win32 operating system. Note: You don't even need a Win32 PC if you are comfortable installing Perl under other operating systems like Linux, but not all the information here will be relevant. You don't need a complier. How to use this tutorial... Just work through from start to finish. Generally, the explanation follows the code sample. When you finish, please send me a critique. Conventions used in this Tutorial The humour is non-conventional. Use of this document Personal Printouts Intranet usage Just email me and let me know.
How to Read and Write Files in Perl - Tutorial on Reading and Writing Files in Perl
Next: Writing to a file in Perl Perl is an ideal language for working with files. It has the basic capability of any shell script, and some very advanced tools, like regular expressions, that make it infinitely more useful. #! In order to work with this example, you'll need a file for our Perl script to read. Larry Curly Moe When you run the script, the output should be the same as the file itself. open (MYFILE, 'data.txt'); Then we use a simple while loop to automatically read each line of the data file one at a time - this places the value of each line in the temporary variable $_ for one loop. while (<MYFILE>) { Inside the loop, we use the chomp function to clear off the newlines from the end of each line, then we print the value of $_ to show that it was read. chomp; print "$_\n"; Finally we close the filehandle to finish out the program. close (MYFILE);
perldoc::requick
<div class="noscript"><p><strong>Please note: Many features of this site require JavaScript. You appear to have JavaScript disabled, or are running a non-JavaScript capable web browser.</strong></p><p> To get the best experience, please enable JavaScript or download a modern web browser such as <a href=" Explorer 8</a>, <a href=" <a href=" or <a href=" Chrome</a>. </p></div> perlrequick - Perl regular expressions quick start This page covers the very basics of understanding, creating and using regular expressions ('regexes') in Perl. Simple word matching The simplest regex is simply a word, or more generally, a string of characters. "Hello World" =~ /World/; # matches Expressions like this are useful in conditionals: print "It matches\n" if "Hello World" =~ /World/; a?
Procmail Homepage
cURL - Tutorial
cURL Docs Tutorial HTTP Scripting 1.1 Background1.2 The HTTP Protocol1.3 See the Protocol1.4 See the Timing1.5 See the Response 2.1 Spec2.2 Host2.3 Port number2.4 User name and password2.5 Path part Fetch a page HTML forms 4.1 Forms explained4.2 GET4.3 POST4.4 File Upload POST4.5 Hidden Fields4.6 Figure Out What A POST Looks Like HTTP upload HTTP Authentication 6.1 Basic Authentication6.2 Other Authentication6.3 Proxy Authentication6.4 Hiding credentials More HTTP Headers 7.1 Referer7.2 User Agent Redirects 8.1 Location header8.2 Other redirects Cookies 9.1 Cookie Basics9.2 Cookie options 10.1 HTTPS is HTTP secure10.2 Certificates Custom Request Elements 11.1 Modify method and headers11.2 More on changed methods Web Login 12.1 Some login tricks Debug 13.1 Some debug tricks References 14.1 Standards14.2 Sites 1. 1.1 Background This document assumes that you're familiar with HTML and general networking. Curl is not written to do everything for you. 1.2 The HTTP Protocol The client, curl, sends a HTTP request. or 3.
Perl globbing tutorial - Reading a directory in perl, learn how to get a directory list.
It's very simple to print a list of all files in a directory using the built-in Perl glob function. Let's look over a short script that globs and prints a list of all files, in the directory containing the script itself: #!/usr/bin/perl -w @files = <*>; foreach $file (@files) { print $file . When you run the program, you'll see it output the filenames of all files in the directory, one per line. @files = <*>; Then we simply use a foreach loop to print out the files in the array. You can include any path in your filesystem between the <> marks. @files = </var/www/htdocs/*>; Or if you just want a list of the files with the extension .html: @files = </var/www/htdocs/*.html>;
main ref
<div class="noscript"><p><strong>Please note: Many features of this site require JavaScript. You appear to have JavaScript disabled, or are running a non-JavaScript capable web browser.</strong></p><p> To get the best experience, please enable JavaScript or download a modern web browser such as <a href=" Explorer 8</a>, <a href=" <a href=" or <a href=" Chrome</a>. </p></div> perlre - Perl regular expressions This page describes the syntax of regular expressions in Perl. If you haven't used regular expressions before, a quick-start introduction is available in perlrequick, and a longer tutorial introduction is available in perlretut. Modifiers Matching operations can have various modifiers. m Treat string as multiple lines. /x # Delete (most) C comments. s/foo/\Ubar/il /l /u
Python Programming Language – Official Website
How to wait for a certain period of time in Perl on Linux
perldoc
The Universal Operating System
sprintf
Perl does its own sprintf formatting: it emulates the C function sprintf(3), but doesn't use it except for floating-point numbers, and even then only standard modifiers are allowed. Non-standard extensions in your local sprintf(3) are therefore unavailable from Perl. Unlike printf , sprintf does not do what you probably mean when you pass it an array as your first argument. The array is given scalar context, and instead of using the 0th element of the array as the format, Perl will use the count of elements in the array as the format, which is almost never useful. Finally, for backward (and we do mean "backward") compatibility, Perl permits these unnecessary but widely-supported conversions: Note that the number of exponent digits in the scientific notation produced by %e , %E , %g and %G for numbers with the modulus of the exponent less than 100 is system-dependent: it may be three or less (zero-padded as necessary). An explicit format parameter index, such as 2$ . one or more of: So: