PERL "In a NUTSHELL",....u mean PERL IN 1900 PAGES! perl og designed for text procesing perl language is based on perl modules book might be outdated perl.com, baby already on chapter 2 CPAN, comprehensive perl archive network perl documentation,,pod(plain old documentation) first line of perl programs: #!/usr/bin/perl When you write a Perl program, you can just give it a correct #! line at the top of the script, make it executable with chmod +x, and run it. pausing to try chmod all whitespace is equivilent statements end in semicolons # is a single line comment = thru =cut is a multi line comment three basic data types: scalars, arrays, and hashes. scalars are normal variables: ints, floats, strings, etc. preceeded by a $ arrays are ordered scalars preceeded by @ hashes are lists of pairs preceded by % another way to make hashes: %fruit = ( apples => 3, oranges => 6 ); label: SOMELABEL: { ...statements... } conditionals// ifs: if (expression) {block} else {block} unless (expression) {block} else {block} if (expression1) {block} elsif (expression2) {block} ... elsif (lastexpression) {block} else {block} others// foreach var (list) { ... } ---!cool! cool!::stamentsssss $i = $num if ($num < 50); # $i will be less than 50 $j = $cnt unless ($cnt < 100); # $j will equal 100 or greater $lines++ while ; print "$_\n" until /The end/; loop control: last label next label redo label also goto $PID The pid of the Perl process running this script. setting all values in an array or list: @ones = (5) x @ones; # set all elements to 5 regular expressions = sed search are replace functions! "The backreferencing variables are: $+ Returns the last parenthesized pattern match $& Returns the entire matched string $` Returns everything before the matched string $' Returns everything after the matched string " "Any variables you use in the function that aren't declared private are global variables." pointers are called references, denoted by / pointer dereferencing $$, @r$, or %$r depending on the data type "STDIN, STDOUT, and STDERR. By default, the print and write functions write to STDOUT. Additional filehandles are created using the open function: " "To open a file for writing, prefix the filename with a greater-than sign: open(OUT, ">outfile"); To open a file for appending, prefix the filename with two greater-than signs: open(LOGFILE, ">>error_log"); " formats: formatting for printing or writing a file to follow. lots of per functions! chapter 5 is a list of functions in alphabetical order! notes will be taken on the most interesting ones. chomp: removes line ending characters chop removes last character in a string crypt: . "crypt can be used to check that a password is correct by comparing the string from the function to the string found in /etc/passwd (if you have permission to do this)" eof end of file exec forks child command fork, spawns child process getlogin = Returns the current login from /etc/utmp (Unix systems only), if any. If null, use getpwuid. "getpwnam getpwnam name Retrieves the passwd file entry of a user, name. The return value in list context is: " mkdir make a directory "my" declares a variable open - opens a file time - "Returns the number of non-leap seconds since January 1, 1970" "Of course everyone writes perfect code on the first try" run script with -w switch which prints warnings run scripts with -d debugs ahhhh! every debug switchhhhhhhh debugger is customizable modules are he object oriented part of perl a list of modules B::C generates c source from perl B::Disassembler - dissasembles perl code "timeit timeit (count, code) Runs code and reports the time it took. Always exported. Takes the following arguments: " CGI::Cookie cwd - current corking directory "Data::Dumper Converts Perl data structures into strings that can be printed or used with eval to reconstruct the original structures. " perl uses sed and awk functions nonono - dont really do it switch Initializes constants, .SUFFIXES, and .PHONY. perl has lots of math modules good module: ping "Text::Soundex Implements the soundex algorithm, which hashes a word (in particular, a surname) into a compressed form that approximates the sound of the word when spoken by an English speaker. " thread - seperate process Time::Local - plagued by 2nd y2k::January 1, 2038. perl is the post common language for CGI programming CGI commonly used for passing data into a program from the web CGI.pm is the very important perl module to get stuff done in CGI use CGI param,header,p; (to specify which tags to use) this book is full of reference pages. that's why it's so long "cookie $cookie=$query->cookie('name') Defines or retrieves a cookie. See also header. name Name of the cookie (required). Using named parameters, the syntax is: $cookie = $query->cookie(-name=>'name', -value=>'value', -expires=>'expcode', -path=>'partial_url', -domain=>'domain_name', -secure=>1); print $query->header(-cookie=>$cookie); " cgi requires forking processes each time it is used. mod_perl is a solution to the forking problem. DBM - compatible perl database some DBI methods: "data_sources @drivers = DBI->data_sources(driver) Returns a list of all databases available to the named driver. (The database server must be running for data_sources to return any results.)" perl and networking is "easy" "Sockets are the underlying mechanism for networking on the Internet. With sockets, one application (a server) sits on a port waiting for connections. Another application (the client) connects to that port and says hello; then the client and server have a chat. " perl is good for sockets! modules and protocols for non http: POP3 Net::POP3 Post Office Protocol, for reading email SMTP Net::SMTP Simple Mail Transfer Protocol, for sending email FTP Net::FTP File Transfer Protocol, for transferring files between hosts NNTP Net::NNTP Network News Transfer Protocol, for reading Usenet new mail modules use actualy email programs NET:POP3 seems the besttt usenet has been around since 79 perl is undoubtably the language used by spammers LWP Library for Web access in Perl can create webpages with LWP though why would you want to? "as_string $rob->as_string( ) Returns a human-readable string that describes the robot's status. " i love all this robot talk: "host_wait $rob->host_wait(netloc) Returns the number of seconds the robot must wait before it can request another resource from the server identified by netloc. " LWP::Simple - used for storing web pages netscape has different style cookies than every other browser this is how your mind works: "Invokes the callback subroutine for each cookie in the cookie jar. " Perl/Tk is for writing programs on unix and windows with a gui idea create drawings using GUI methods perl is good for windows, i guess. win32::clipboard allows perl access to windows clipboard..... such as "$text = Win32::Clipboard::Get(); Win32::Clipboard::Set("blah blah blah"); Win32::Clipboard::Empty(); " win32::console is main perl module to use win32::filesecurity - work with file permissions...yikes! awesome idea: "The default value is infinity." "The Win32::IPC module provides synchronization for multiple objects created from the Semaphore, Mutex, Process, and ChangeNotify classes. This wait method of this class is inherited by objects of the preceding modules, as well as the functions wait_all and wait_any. You should not need to call Win32::IPC directly. "......BOOORRIINNGGGG netadmin provides ways to administer windowsNT servers using perl perlscript - perl that can be embedded in an html file