From d.bussenschutt at mailbox.gu.edu.au Tue Sep 17 02:25:30 2002 From: d.bussenschutt at mailbox.gu.edu.au (David Bussenschutt) Date: Wed Aug 4 23:58:59 2004 Subject: [BNE-PM] you lot have all gone quiet again? Message-ID: Is it just me... or have you lot out there on this list all gone quiet again. We'll be having none of that!. Ok, here's my challenge to you all: I want one-liners. useful, useless, fun,necessary,unique,quirky, whatever I don't care. Let's see what interesting one-liner perl programs you lot have come up with. Send-em to the list, and we'll all become a little wiser as a result. here's one from one of my co-workers to get us started.... can you tell me exactly what it does? (without running it) perl -le 'for(1..100){print}' | column # ( the column command is probably a linux only command) ...and how is the above one different from something like this....? perl -le 'for(1..100){print}' | pr -7 -t -l20 David. -------------------------------------------------------------------- David Bussenschutt Email: D.Bussenschutt@mailbox.gu.edu.au Senior Computing Support Officer & Systems Administrator/Programmer RedHat Certified Engineer. Member of Systems Administrators Guild of Australia. Location: Griffith University. Information Technology Services Brisbane Qld. Aust. (TEN bldg. rm 1.33) Ph: (07)38757079 -------------------------------------------------------------------- From anthony at cit.gu.edu.au Tue Sep 17 03:00:46 2002 From: anthony at cit.gu.edu.au (Anthony Thyssen) Date: Wed Aug 4 23:58:59 2004 Subject: [BNE-PM] you lot have all gone quiet again? (Fwd) Message-ID: <200209170800.g8H80kZ28889@wumpus.cit.gu.edu.au> ------- Forwarded Message From: Anthony Thyssen To: "David Bussenschutt" Subject: Re: [BNE-PM] you lot have all gone quiet again? Date: Tue, 17 Sep 2002 18:00:19 +1000 Reply-to: Anthony Thyssen "David Bussenschutt" on wrote... | Is it just me... or have you lot out there on this list all gone quiet | again. We'll be having none of that!. | | Ok, here's my challenge to you all: I want one-liners. useful, | useless, fun,necessary,unique,quirky, whatever I don't care. Let's see | what interesting one-liner perl programs you lot have come up with. | Send-em to the list, and we'll all become a little wiser as a result. | | here's one from one of my co-workers to get us started.... can you tell me | exactly what it does? (without running it) | perl -le 'for(1..100){print}' | column # ( the | column command is probably a linux only command) | | ...and how is the above one different from something like this....? | perl -le 'for(1..100){print}' | pr -7 -t -l20 | As the co-worker... How about this perl chalange... Write a print one-linter that can take the place of either the "column" or "pr" command above :-) Anthony Thyssen ( System Programmer ) http://www.sct.gu.edu.au/~anthony/ ----------------------------------------------------------------------------- No one ever listens to Zatheris. "Quite Mad!", thay say. It is good the Zatheris does not mind. He has even grown to like it. Oh yes! -- Zatheris's Mumbling, Bablyon 5, ``War Without End'' ----------------------------------------------------------------------------- Anthony's Home is his Castle http://www.sct.gu.edu.au/~anthony/ ------- End of Forwarded Message From derek at wedgetail.com Tue Sep 17 05:27:57 2002 From: derek at wedgetail.com (Derek Thomson) Date: Wed Aug 4 23:58:59 2004 Subject: [BNE-PM] you lot have all gone quiet again? (Fwd) References: <200209170800.g8H80kZ28889@wumpus.cit.gu.edu.au> Message-ID: <3D8703AD.5030103@wedgetail.com> Anthony Thyssen wrote: > ------- Forwarded Message > > From: Anthony Thyssen > To: "David Bussenschutt" > Subject: Re: [BNE-PM] you lot have all gone quiet again? > Date: Tue, 17 Sep 2002 18:00:19 +1000 > Reply-to: Anthony Thyssen > > "David Bussenschutt" on wrote... > | Is it just me... or have you lot out there on this list all gone quiet > | again. We'll be having none of that!. > | > | Ok, here's my challenge to you all: I want one-liners. useful, > | useless, fun,necessary,unique,quirky, whatever I don't care. Let's > | see > | what interesting one-liner perl programs you lot have come up with. > | Send-em to the list, and we'll all become a little wiser as a > | result. I didn't know about the "-l" option. Handy, that! > > As the co-worker... How about this perl chalange... > > Write a print one-linter that can take the place of either > the "column" or "pr" command above :-) Horizontal columns is easy: perl -le 'print for 1..100' | perl -ne 'chomp; print "$_\t"; print "\n" unless $. % 10' (it's less than 80 columns if you disregard the separate program that generates the numbers, so it's a valid one-liner) Vertical columns are much harder. Here's a start: perl -le 'print for 1..104' | perl -e '@a=<>; chomp @a; $c=int(@a/10)+(@a%10>0); for $i (0..$c-1) { for ($j=0; $j<@a; $j+=$c) { printf "%6d", $a[$i+$j] } print "\n"; }' This is too long by far, and has a bug - "filler" values in the final column are printed as "0". I could fix that, but it's too long already :( Suggestions? Possibly the best solution for vertical columns is to get the Array::PrintCols module from CPAN, and use that: perl -le 'print for 1..104' | perl -MArray::PrintCols -e '@a=<>; chomp @a; print_cols \@a' Yes, that's breaking the rules for one-liners - no modules (*everything* can be done in one line if you've got CPAN!) -- D. From anthony at cit.gu.edu.au Wed Sep 18 01:39:18 2002 From: anthony at cit.gu.edu.au (Anthony Thyssen) Date: Wed Aug 4 23:58:59 2004 Subject: [BNE-PM] you lot have all gone quiet again? (Fwd) In-Reply-To: Your message of "Tue, 17 Sep 2002 20:27:57 +1000." <3D8703AD.5030103@wedgetail.com> Message-ID: <200209180639.g8I6dII03770@wumpus.cit.gu.edu.au> Derek Thomson on wrote... | Anthony Thyssen wrote: | Horizontal columns is easy: | | perl -le 'print for 1..100' | perl -ne 'chomp; print "$_\t"; print "\n" | unless $. % 10' | This will fail if strings are occasionaly longer than 8 characters :-) You are right It actually isn't easy as a one liner. A very complex issue that even ls often does badly at. | Yes, that's breaking the rules for one-liners - no modules (*everything* | can be done in one line if you've got CPAN!) | Modules (standard perl modules that is) are in my oppion permissible in perl one liners ;-) Never heard of Array::PrintCols! Not a standard perl module. I'll have to look it up. Anthony Thyssen ( System Programmer ) http://www.sct.gu.edu.au/~anthony/ ----------------------------------------------------------------------------- The universe is run by the complex interweaving of 3 elements; energy, matter, and, enlightened self interest. -- Ambassador G'Kar - Bablyon 5 ----------------------------------------------------------------------------- Anthony's Home is his Castle http://www.sct.gu.edu.au/~anthony/ From derek at wedgetail.com Wed Sep 18 01:51:54 2002 From: derek at wedgetail.com (Derek Thomson) Date: Wed Aug 4 23:58:59 2004 Subject: [BNE-PM] you lot have all gone quiet again? (Fwd) References: <200209180639.g8I6dII03770@wumpus.cit.gu.edu.au> Message-ID: <3D88228A.8070702@wedgetail.com> Anthony Thyssen wrote: > Derek Thomson on wrote... > | Anthony Thyssen wrote: > | Horizontal columns is easy: > | > | perl -le 'print for 1..100' | perl -ne 'chomp; print "$_\t"; print "\n" > | unless $. % 10' > | > This will fail if strings are occasionaly longer than 8 characters :-) Yes, that's right. The code to fix it would make it too long :( > > You are right It actually isn't easy as a one liner. > A very complex issue that even ls often does badly at. > > | Yes, that's breaking the rules for one-liners - no modules (*everything* > | can be done in one line if you've got CPAN!) > | > Modules (standard perl modules that is) are in my oppion permissible in > perl one liners ;-) There are even two kinds of "standard" module - those that come with a Perl distro, and those you can get from CPAN. So we'd have to define exactly what is allowed and what isn't. I'd say modules should be disallowed, as the purpose of the one liner game is to show what can be done with the language itself. Clever and devious use of modules would be another type of competition, I think. I don't know what the rules and goals of this game would be, I'd have to think about it. > > Never heard of Array::PrintCols! Not a standard perl module. > I'll have to look it up. Neither had I, but I had faith that there would be one. A quick search on http://search.cpan.org, and there it was! That happens a lot with Perl - the solution is often just on CPAN! -- D. From derek at wedgetail.com Wed Sep 18 05:58:23 2002 From: derek at wedgetail.com (Derek Thomson) Date: Wed Aug 4 23:58:59 2004 Subject: [BNE-PM] The Perl one-liner Message-ID: <3D885C4F.3050603@wedgetail.com> Hi all, Some of you may be wondering what all this Perl "one liner" business is all about. So, here's a quick intro ... Perl is a useful and powerful programming language. However, it can also be used from the command line, just like standard tools such as sed, grep or sort (and can therefore be combined with these tools to work great magic!). The key to this use of Perl is the "-e" flag. This allows you to specify Perl code to execute right on the command line. For example: $ perl -e 'print "Hello, world\n"' ... outputs the string and exits. Now, I hear you cry, this is not as good as (say) sed, as I must write a loop to read in the input each time, like this: $ perl -e 'while (<>) { s/Foo/Bar/g; print }' ... which changes all the Foo to Bar. However, someone thought of that, and so you have the "-n" option, which wraps your code in an invisible "while (<>) { ... }" loop. So we could shorten the above as: $ perl -ne 's/Foo/Bar/g; print' All well and good, but it's so common that we want to read each line, alter it and print the result, can't this be made even shorter? Yes, with the "-p" option, which is the same as "-n", but prints the line after each execution of the loop body. $ perl -pe 's/Foo/Bar/g' So, now we have re-invented "sed", but with the power of Perl regexes available to us. That's a starting point - now the game is to do as much as you can using these constructs (and any others - see the perlrun manpage for more) in one line (usually 80 characters). It's a great way to learn about these command line options, and how to use the implicit argument variable "$_", to pack as much meaning into as little syntax as possible. You could start by re-inventing "grep" - a program which reads each line of input, and prints only those lines that match a regular expression. -- D. From paran01d at operamail.com Wed Sep 18 18:20:43 2002 From: paran01d at operamail.com (Mike Bissett) Date: Wed Aug 4 23:58:59 2004 Subject: [BNE-PM] The Perl one-liner Message-ID: <20020918232043.4093.qmail@operamail.com> So how long do you think it will be until one liner comps are replaced by people writing programs as parrot bytecode :). MikeB -- __________________________________________________________ Download the FREE Opera browser at www.opera.com/download/ Free OperaMail at http://www.operamail.com/ Powered by Outblaze From derek at wedgetail.com Wed Sep 18 20:14:41 2002 From: derek at wedgetail.com (Derek Thomson) Date: Wed Aug 4 23:58:59 2004 Subject: [BNE-PM] The Perl one-liner References: <20020918231637.11160.qmail@operamail.com> Message-ID: <3D892501.9050005@wedgetail.com> [I'm posting my reply to the list, as the answer may be generally helpful, and I'm pretty sure you meant the original to go to the list!] Mike Bissett wrote: > > >> >>$ perl -pe 's/Foo/Bar/g' > > > I always wondered what those lfags did :) now i know. > Yes, they're great, aren't they? For more deviousness, check out the perlrun manpage for the "-a" flag. If no one uses it in a response, I'll give a brief run-down of its wonderousness in combination with "-p", "-n", and "-e". > > I tried Something like > > perl -ne 'print if /$_/' > > but i couldnt work out how to pass my search string as an > arg to perl (it assumes im calling a script) any ideas ? Close. But this is matching the line read against *itself*. I'll expand this a little to make this clear. What this means is: $ perl -ne 'print if $_ =~ /$_/' See? You really want to match the line against the pattern, like this: $ perl -ne 'print if $_ =~ /Foo/' ... but because the match "//" operator works on the "$_" variable by default, you can reduce this to: $ perl -ne 'print if /Foo/' Now, if you're using this on the command line, there's no need to pass an arg to Perl, you just put the pattern right into the code: $ ls | perl -ne 'print if /(Foo).*\1/' ... selects all those files with two "Foo"s in the name. If you do want to pass command line arguments to Perl (say if you were writing 'pgrep', a Perl alternative to 'grep') you'd use the @ARGV array, which contains all the arguments given to the program. So, a first stab at pgrep might be: #!/usr/bin/perl -w use strict; sub show_usage(); # # Grab the first command line argument off the array, it is the regex # pattern to match against. # show_usage and exit 1 if @ARGV < 1; my $pattern = shift @ARGV; # # Read each line from the remaining arguments (files) on the command # line and then from stdin. # while (<>) { # Print the line if it matches the pattern. print if /$pattern/; } # # Print out the program usage information. # sub show_usage() { print << 'END_USAGE'; Usage: pgrep pattern [file] ... END_USAGE } Now you can say: $ ls | pgrep '(Foo).*\1' ... to do the same thing. Because of the magic way the '<>' operator works, you can also match against any number of files: $ pgrep '(Foo).*\1' file1 file2 file3 > > P.S. for those interested my brother has finally gotten > round to putting his pictures of the last meeting online > at > http://www.tekuiti.co.uk/photos/index.cgi?mode=album&album=./Holiday%203 Beaut! -- D. From derek at wedgetail.com Wed Sep 18 21:04:53 2002 From: derek at wedgetail.com (Derek Thomson) Date: Wed Aug 4 23:58:59 2004 Subject: [BNE-PM] The Perl one-liner References: <20020919013433.21420.qmail@operamail.com> Message-ID: <3D8930C5.5000502@wedgetail.com> Mike, can you please post to the list, not just to me? That way, the discussion benefits everyone. Again, I'm replying to the list. Call me rude, but I don't want to explain BEGIN and END twice! Mike Bissett wrote: > > I figured i was wrong with the $_ ... doh ! .. but do you > know of anyway to pass args to a one liner though ? > if you try to pass them on the perl command line it > assumes there files ? Like I said, you don't need to use @ARGV on the command line - you just put the pattern straight into the code! Is this for some other problem? Context, please! If you wanted to do this for some reason, wouldn't it just be: $ ls | perl -e '$p = shift @ARGV; while (<>) {print if /$p/}' Foo ?? Notice that we can't use the -n option, as we don't want the "shift @ARGV" in the loop! Another way around the "start/finish" problem with "-n" and "-p" is to use BEGIN and END blocks, which execute code when a program starts, and when it finishes. $ ls | perl -ne 'BEGIN {$p = shift @ARGV} print if /$p/' Foo ... but I honestly can't see what this gains you over: $ ls | perl -ne 'print if /Foo/' ... unless you want to be able to dynamically set the pattern from another source as an argument. But at that point it's time to start considering writing something like my little pgrep program - you don't want to have to type this stuff over and over! -- D. From paran01d at operamail.com Wed Sep 18 21:26:52 2002 From: paran01d at operamail.com (Mike Bissett) Date: Wed Aug 4 23:58:59 2004 Subject: [BNE-PM] The Perl one-liner Message-ID: <20020919022652.32608.qmail@operamail.com> > Mike, can you please post to the list, not just to me? That way, the > discussion benefits everyone. Again, I'm replying to the list. Call me > rude, but I don't want to explain BEGIN and END twice! Sorry my reply button keeps defaulting to the person instead of the list, oh to be rid of this crappy webmail soon..... > Is this for some other problem? Context, please! > Just thought it would be useful to call from scripts etc.. though your right about righting it a s a seperate program etc. > If you wanted to do this for some reason, wouldn't it just be: > $ ls | perl -e '$p = shift @ARGV; while (<>) {print if /$p/}' Foo Unfortunately this doesnt work perl assumes the Foo to be a file for interpreting, i found the -s option but that doesnt seem to work either.. its probably more useless than i thought anyway :) Thanks Mike Bissett -- __________________________________________________________ Download the FREE Opera browser at www.opera.com/download/ Free OperaMail at http://www.operamail.com/ Powered by Outblaze From derek at wedgetail.com Wed Sep 18 23:14:06 2002 From: derek at wedgetail.com (Derek Thomson) Date: Wed Aug 4 23:58:59 2004 Subject: [BNE-PM] The Perl one-liner References: <20020919022652.32608.qmail@operamail.com> Message-ID: <3D894F0E.1090108@wedgetail.com> Mike Bissett wrote: > >>If you wanted to do this for some reason, wouldn't it > > just be: > > >>$ ls | perl -e '$p = shift @ARGV; while (<>) {print if > > /$p/}' Foo > > > Unfortunately this doesnt work perl assumes the Foo to be > a file for interpreting, It works fine for me! Did you try my example exactly? Notice the use of "shift @ARGV". This doesn't just give you the first item in the array, but removes it as well! So, if @ARGV initially contained ("Foo", "file1", "file2", "file3"), and you do "$p = shift @ARGV", $p is now "Foo", and @ARGV is ("file1", "file2", "file3"). Now, when you say "<>", reading will start from "file1", as that is the first item in @ARGV. The pattern "Foo" isn't even in the array, so it can't be used as a file name. > i found the -s option but that > doesnt seem to work either.. No, that's for simple command line "switch" parsing. I actually didn't know about that one! -- D. From derek at wedgetail.com Thu Sep 19 04:55:24 2002 From: derek at wedgetail.com (Derek Thomson) Date: Wed Aug 4 23:58:59 2004 Subject: [BNE-PM] The Perl one-liner References: <200209190655.g8J6tpi20260@wumpus.cit.gu.edu.au> Message-ID: <3D899F0C.8080008@wedgetail.com> Anthony Thyssen wrote: > A much simpler way of doing this is to use the shell quoting to > include your shell veriable into the perl code. I do this all the time > in shell scripts. > > ls | perl -ne "print if m'$pattern'" I've got a simpler answer ... don't write shell scripts! Seriously, I got sick of all the porting problems (each tool has different abilities, restrictions and bugs on each platform), and the fact that shell is just no good once you need even a simple list, let alone complex data structures. So, I just do everything in Perl, apart from shell scripts that follow this form: #!/bin/sh # Set some environment variables and check config stuff # Run a program # Do whatever clean up needs to be done ... in other words, just the occasional convenience wrapper. As soon as I need a loop, or an "if", I throw it away and do it in Perl. Then it works properly, everywhere (even on Windows). And you don't have all this painful mucking about with quotes! So, if I were in the middle of my Perl program, and suddenly needed to list the files that matched a regular expression, I would just: my $dir = DirHandle->new('.'); my @files = grep /$pattern/, $dir->read; $dir->close; ... and the matches are now in @files, which I can then do whatever I like with. (The Perl "grep" function selects items from a list based on the pattern, the "read" method is smart enough to know that you want all the files in that context, and of course you would need to have imported DirHandle with "use DirHandle;"). No need to call "ls" from Perl (which I see a lot), and no need to call Perl from shell. I will go as far as to say there's rarely any need to invoke a standard Unix command from Perl - there's a module in the standard distro for pretty much everything. Calling "ls" or "cp" or whatever from Perl just makes your code non-portable, and very slow ... and forcing yourself not to do this is a good way to learn about the standard modules! -- D. From derek at wedgetail.com Thu Sep 19 09:23:42 2002 From: derek at wedgetail.com (Derek Thomson) Date: Wed Aug 4 23:58:59 2004 Subject: [BNE-PM] My one liner! Message-ID: <3D89DDEE.3040703@wedgetail.com> Hi, Here's my entry in the one-line challenge. You get to figure out what it does. Just give it any text file. Here's a hint - it'll be more obvious what it's doing if you give it a text file that contains English (or any other language for human consumption) ... Here, I feed it the perl manpage: $ man perl | perl -wane '$_++ for @h{@F}; END { print "$_\t$h{$_}\n" for sort keys %h }' If there are any questions about how exactly this works, ask away! -- D. From Don.Simonetta at mincom.com Thu Sep 19 16:53:55 2002 From: Don.Simonetta at mincom.com (Don.Simonetta@mincom.com) Date: Wed Aug 4 23:58:59 2004 Subject: [BNE-PM] The Perl one-liner Message-ID: Totally agree with you Derek. My only comment is if you don't want to go to the trouble of importing DirHandle, you could use the standard perl functions of opendir & readdir. -----Original Message----- From: owner-brisbane-pm-list@pm.org [mailto:owner-brisbane-pm-list@pm.org] On Behalf Of derek@wedgetail.com Sent: Thursday, 19 September 2002 19:55 To: anthony@cit.gu.edu.au Cc: brisbane-pm-list@happyfunball.pm.org Subject: Re: [BNE-PM] The Perl one-liner Anthony Thyssen wrote: > A much simpler way of doing this is to use the shell quoting to > include your shell veriable into the perl code. I do this all the time > in shell scripts. > > ls | perl -ne "print if m'$pattern'" I've got a simpler answer ... don't write shell scripts! Seriously, I got sick of all the porting problems (each tool has different abilities, restrictions and bugs on each platform), and the fact that shell is just no good once you need even a simple list, let alone complex data structures. So, I just do everything in Perl, apart from shell scripts that follow this form: #!/bin/sh # Set some environment variables and check config stuff # Run a program # Do whatever clean up needs to be done ... in other words, just the occasional convenience wrapper. As soon as I need a loop, or an "if", I throw it away and do it in Perl. Then it works properly, everywhere (even on Windows). And you don't have all this painful mucking about with quotes! So, if I were in the middle of my Perl program, and suddenly needed to list the files that matched a regular expression, I would just: my $dir = DirHandle->new('.'); my @files = grep /$pattern/, $dir->read; $dir->close; ... and the matches are now in @files, which I can then do whatever I like with. (The Perl "grep" function selects items from a list based on the pattern, the "read" method is smart enough to know that you want all the files in that context, and of course you would need to have imported DirHandle with "use DirHandle;"). No need to call "ls" from Perl (which I see a lot), and no need to call Perl from shell. I will go as far as to say there's rarely any need to invoke a standard Unix command from Perl - there's a module in the standard distro for pretty much everything. Calling "ls" or "cp" or whatever from Perl just makes your code non-portable, and very slow ... and forcing yourself not to do this is a good way to learn about the standard modules! -- D. -- This transmission is for the intended addressee only and is confidential information. If you have received this transmission in error, please delete it and notify the sender. The contents of this e-mail are the opinion of the writer only and are not endorsed by the Mincom Group of companies unless expressly stated otherwise. From Don.Simonetta at mincom.com Thu Sep 19 17:26:01 2002 From: Don.Simonetta at mincom.com (Don.Simonetta@mincom.com) Date: Wed Aug 4 23:58:59 2004 Subject: [BNE-PM] My 0 liner Message-ID: I don't usually use perl for one liner commands (except to check syntax of things I'm trying out). So I don't really have much to contribute. But I remember an example I'd seen in a tutorial. I looked this up again today and realised I can do something really powerful without even writing 1 line of perl code! Here is my simplified version of the example: perl -p -i.bak -e '' This will take a list of files and create copies of them with (in this case) a ".bak" extension. -- This transmission is for the intended addressee only and is confidential information. If you have received this transmission in error, please delete it and notify the sender. The contents of this e-mail are the opinion of the writer only and are not endorsed by the Mincom Group of companies unless expressly stated otherwise. From anthony at cit.gu.edu.au Thu Sep 19 20:26:31 2002 From: anthony at cit.gu.edu.au (Anthony Thyssen) Date: Wed Aug 4 23:58:59 2004 Subject: [BNE-PM] The Perl one-liner In-Reply-To: Your message of "Thu, 19 Sep 2002 19:55:24 +1000." <3D899F0C.8080008@wedgetail.com> Message-ID: <200209200126.g8K1QVI32516@wumpus.cit.gu.edu.au> Derek Thomson on wrote... | Anthony Thyssen wrote: | > A much simpler way of doing this is to use the shell quoting to | > include your shell veriable into the perl code. I do this all the time | > in shell scripts. | | > | > ls | perl -ne "print if m'$pattern'" | | I've got a simpler answer ... don't write shell scripts! Seriously, I | got sick of all the porting problems (each tool has different abilities, | restrictions and bugs on each platform), and the fact that shell is just | no good once you need even a simple list, let alone complex data structures. | If the script is only running commands, eg has to run a lot of ssh Or bascially consists of a command with lots of options and a couple of minor calculations or checks, then a shell script is still better. It is this sort of situation that the above "substitute argument" works very well. If it is extremely simple (for example - auto background, or a command with a specific set of arguments) I don't even bother with a shell script, I use a csh (or a shell function) alias. The only other time I avoided perl is when a script may run of systems where perl may not be installed, expecially new ones still being installed!!! OR it has to be sourced by the command shell as it must change the shells environment (EG: shell setup/modification). But you are right for anything else, especially when dealling with data, or file manipulation, or just has security concerns, perl is the go. | Calling "ls" or "cp" or whatever from Perl just makes your code | non-portable, and very slow ... and forcing yourself not to do this | is a good way to learn about the standard modules! | Agree but ther are things that it is a lot easier to call a command for. File system dumps are one good example. That is when either no module is available or you know the command line method, but don't need or what to know the "proper" perl interface. Anthony Thyssen ( System Programmer ) http://www.sct.gu.edu.au/~anthony/ ----------------------------------------------------------------------------- "You must realize that the computer has it in for you. The irrefutable proof of this is that the computer always does what you tell it to do." ----------------------------------------------------------------------------- Anthony's Home is his Castle http://www.sct.gu.edu.au/~anthony/ From derek at wedgetail.com Thu Sep 19 22:49:40 2002 From: derek at wedgetail.com (Derek Thomson) Date: Wed Aug 4 23:58:59 2004 Subject: [BNE-PM] My 0 liner References: Message-ID: <3D8A9AD4.50305@wedgetail.com> Don.Simonetta@mincom.com wrote: > > perl -p -i.bak -e '' > > This will take a list of files and create copies of them with (in this > case) a ".bak" extension. > > That's great! I use the "-i" option a lot to make global changes across lots of files in a source tree (*), and I'd never thought of that. I think you clearly win the "shortest useful Perl program" award! (*) As in something like: $ find . -name '*.c' | xargs perl -p -i.bak -e 's/old_func_name/new_func_name/g' ... and the old versions of all the files are safely backed up in the ".bak" files. -- D. From derek at wedgetail.com Thu Sep 19 22:59:49 2002 From: derek at wedgetail.com (Derek Thomson) Date: Wed Aug 4 23:58:59 2004 Subject: [BNE-PM] The Perl one-liner References: Message-ID: <3D8A9D35.2060202@wedgetail.com> Don.Simonetta@mincom.com wrote: > Totally agree with you Derek. > My only comment is if you don't want to go to the trouble of importing > DirHandle, you could use the standard perl functions of opendir & > readdir. I've gotten so used to using DirHandle and IO::File, it just came out that way! I *always* use these, as the whole file handle identifier thing is a kludge. When you say: open FILE, "< file"; ... how do you then pass FILE to a function? How do you put it into an array or a hash? You can't, unless you pass the symbol table entry for the identifier (the "typeglob"). This is so much low-level hacking for such a simple thing, and is such a stumbling block to learners, that I just teach: $file = IO::File->new("< file"); ... right from the start. Since $file is just a reference, you can pass it to functions, assign it to other variables, put it in arrays and hashes, and the world is a better and saner place. The "read line" operator "<>" even works with this, as in "while (<$file>) { ... }", so there's no reason that I can see to use the older notation. -- D. From d.bussenschutt at mailbox.gu.edu.au Thu Sep 19 23:21:20 2002 From: d.bussenschutt at mailbox.gu.edu.au (David Bussenschutt) Date: Wed Aug 4 23:58:59 2004 Subject: [BNE-PM] The Perl one-liner Message-ID: Speaking of filehandle identifiers, typeglobs and kludges..... just the day before yesterday, I was funbling with this very same "typeglob" issue, and how to pass this around into functions etc. EXCEPT, mine wasn't a filehandle, so I couldn't use IO:File ... it was a Socket. I didn't want to 'use IO:Socket' because it's got quite large overheads in comparison to just 'use Socket'. Of course, the other problem was that I was creating the socket inside a ->new() object creation routine, and had to then save this newly created socket/filehandle into the anonymous hash that the object uses for it's object data. I eventually figured out the following... .... below this is an extract showing the creation of the object/socket. The really important line is the use of Symbol::gensym() to generate a reference to a typeglob that I then store into a scalar ( $self->{socket} ) that is part of the object $self. This bit took me a while to figure out.....eventually I stumbled onto a note about 'Symbol' in one of my 4 perl reference books , and I immediately said "that's it!"... ;-) .... use Symbol; sub new { my invocant = shift; my $class = ref($invocant) || $invocant; my $self = { server => '1.2.3.4', port => '1234', @_, }; ${$self->{socket}} = Symbol::gensym(); # get a reference to a new typeglob socket(${$self->socket}},PF_INET,SOCK_STREAM,getprotobyname('tcp')); # make the socket my $i_addr = inet_aton($self-{server}); # get ip of server my $addr = sockaddr_in($self->{port},$i_addr); #get full addr of server (ip+port) conect(${$self->socket}},$addr); # connect to the server. select((select(${$self->socket}}), $|=1)[0]); # autoflush buffers return bless $self, $class; # return the new object } David. -------------------------------------------------------------------- David Bussenschutt Email: D.Bussenschutt@mailbox.gu.edu.au Senior Computing Support Officer & Systems Administrator/Programmer RedHat Certified Engineer. Member of Systems Administrators Guild of Australia. Location: Griffith University. Information Technology Services Brisbane Qld. Aust. (TEN bldg. rm 1.33) Ph: (07)38757079 -------------------------------------------------------------------- Derek Thomson Sent by: owner-brisbane-pm-list@pm.org 20/09/2002 01:59 PM To: Don.Simonetta@mincom.com cc: anthony@cit.gu.edu.au, brisbane-pm-list@happyfunball.pm.org Subject: Re: [BNE-PM] The Perl one-liner Don.Simonetta@mincom.com wrote: > Totally agree with you Derek. > My only comment is if you don't want to go to the trouble of importing > DirHandle, you could use the standard perl functions of opendir & > readdir. I've gotten so used to using DirHandle and IO::File, it just came out that way! I *always* use these, as the whole file handle identifier thing is a kludge. When you say: open FILE, "< file"; ... how do you then pass FILE to a function? How do you put it into an array or a hash? You can't, unless you pass the symbol table entry for the identifier (the "typeglob"). This is so much low-level hacking for such a simple thing, and is such a stumbling block to learners, that I just teach: $file = IO::File->new("< file"); ... right from the start. Since $file is just a reference, you can pass it to functions, assign it to other variables, put it in arrays and hashes, and the world is a better and saner place. The "read line" operator "<>" even works with this, as in "while (<$file>) { ... }", so there's no reason that I can see to use the older notation. -- D. From derek at wedgetail.com Fri Sep 20 00:00:42 2002 From: derek at wedgetail.com (Derek Thomson) Date: Wed Aug 4 23:58:59 2004 Subject: [BNE-PM] The Perl one-liner References: Message-ID: <3D8AAB7A.7040100@wedgetail.com> David Bussenschutt wrote: > Speaking of filehandle identifiers, typeglobs and kludges..... > > just the day before yesterday, I was funbling with this very same > "typeglob" issue, and how to pass this around into functions etc. EXCEPT, > mine wasn't a filehandle, so I couldn't use IO:File ... it was a Socket. > I didn't want to 'use IO:Socket' because it's got quite large overheads in > comparison to just 'use Socket'. They may be large, but are they really significant? I use IO::Socket throughout my Perl CORBA ORB, without a problem that I've noticed. Remember, your average Java program running on a hotspot JVM (which is necessary to get anything approaching acceptable performance) is going to consume 40-50M by the time it "warms up", and gathers all that data and precompiles all that "hotspot" code. Compared to *that* even 1M or so on a 256M machine just isn't worth worrying about. The total size is still around 5M, so I still win by about 40M on average! Also, I have IO::Socket set up as a dynamic library, so you only pay the price of that 1M *once* across all running Perl programs, so suddenly the effective overhead of IO::Socket can be divided by the count of all running Perl servers and clients. > Of course, the other problem was that I was creating the socket inside a > ->new() object creation routine, and had to then save this newly created > socket/filehandle into the anonymous hash that the object uses for it's > object data. > I eventually figured out the following... > .... > below this is an extract showing the creation of the object/socket. The > really important line is the use of Symbol::gensym() Didn't know that one. Very nice! But still, I'd only do it if there was a good reason to keep the size minimal, premature optimization being the root of all evil ... -- D. From d.bussenschutt at mailbox.gu.edu.au Fri Sep 20 00:32:00 2002 From: d.bussenschutt at mailbox.gu.edu.au (David Bussenschutt) Date: Wed Aug 4 23:58:59 2004 Subject: [BNE-PM] The Perl one-liner Message-ID: Great comments Derek.... but as usual, I didn't properly explain my reasons for wanting to keep my overheads small.. Well, this is a component of a larger web-app/cgi program. The web-app doesn't run in mod_perl or eqivalent, so it's the "warm-up" that matters (and that takes a while) in this application. In the time it takes for a client (real person) to visit my webpage, and have a page displayed, I have to (typically) open up between 6 and 12 sockets to 2-4 different hosts, authenticate these connections securely, pull the relevant data through that I need from this remote server, close the connection, and go on to the next server...I can then analyse this data, and display the relevant info in the webpage. Every once of speed I can get out of my app helps. I expect that I will eventually run in mod_perl, but I haven't needed that yet (or figured it out either) ;-) David -------------------------------------------------------------------- David Bussenschutt Email: D.Bussenschutt@mailbox.gu.edu.au Senior Computing Support Officer & Systems Administrator/Programmer RedHat Certified Engineer. Member of Systems Administrators Guild of Australia. Location: Griffith University. Information Technology Services Brisbane Qld. Aust. (TEN bldg. rm 1.33) Ph: (07)38757079 -------------------------------------------------------------------- Derek Thomson 20/09/2002 03:00 PM To: David Bussenschutt cc: brisbane-pm-list@happyfunball.pm.org Subject: Re: [BNE-PM] The Perl one-liner David Bussenschutt wrote: > Speaking of filehandle identifiers, typeglobs and kludges..... > > just the day before yesterday, I was funbling with this very same > "typeglob" issue, and how to pass this around into functions etc. EXCEPT, > mine wasn't a filehandle, so I couldn't use IO:File ... it was a Socket. > I didn't want to 'use IO:Socket' because it's got quite large overheads in > comparison to just 'use Socket'. They may be large, but are they really significant? I use IO::Socket throughout my Perl CORBA ORB, without a problem that I've noticed. Remember, your average Java program running on a hotspot JVM (which is necessary to get anything approaching acceptable performance) is going to consume 40-50M by the time it "warms up", and gathers all that data and precompiles all that "hotspot" code. Compared to *that* even 1M or so on a 256M machine just isn't worth worrying about. The total size is still around 5M, so I still win by about 40M on average! Also, I have IO::Socket set up as a dynamic library, so you only pay the price of that 1M *once* across all running Perl programs, so suddenly the effective overhead of IO::Socket can be divided by the count of all running Perl servers and clients. > Of course, the other problem was that I was creating the socket inside a > ->new() object creation routine, and had to then save this newly created > socket/filehandle into the anonymous hash that the object uses for it's > object data. > I eventually figured out the following... > .... > below this is an extract showing the creation of the object/socket. The > really important line is the use of Symbol::gensym() Didn't know that one. Very nice! But still, I'd only do it if there was a good reason to keep the size minimal, premature optimization being the root of all evil ... -- D. From derek at wedgetail.com Fri Sep 20 01:19:42 2002 From: derek at wedgetail.com (Derek Thomson) Date: Wed Aug 4 23:58:59 2004 Subject: [BNE-PM] The Perl one-liner References: Message-ID: <3D8ABDFE.4050200@wedgetail.com> David Bussenschutt wrote: > I expect that I will eventually run in > mod_perl, but I haven't needed that yet (or figured it out either) ;-) > I think you're going to have to look at mod_perl before too long. I've never done any CGI/Web app stuff whatsoever, so I can't really say how easy that will be. Another approach would be to get all that work out of the CGI program, and into a server that sits on your machine permanently, and does all the "grunt work". So, your setup looks like this (set your fonts to "fixed width"!): +----------+ +--------------+ | CGI | CORBA/SOAP/adhoc protocol | Perl server | | "script" |---------------------------->| process | +----------+ +--------------+ So, your CGI script just connects to the server, passing the arguments, like say a cookie and some form fields, and gets back shiny new HTML to display. The server never dies, so not only is it "warmed up", but it can also cache database connections, keep those 6-12 sockets open for reuse, cache data from other sources, and so on ad infinitum. You can also move the server to a different, more powerful machine, or even replicate it across many machines! You can use any protocol you like, ranging from standard, like CORBA or SOAP (which has the advantage that you can switch the server to Java/Python/C++/C at will without writing a bunch of code), or just make up your own little ASCII protocol and use that. Anyway, even if you do use mod_perl, I think this design still has many benefits. -- D. From Don.Simonetta at mincom.com Wed Sep 25 23:44:53 2002 From: Don.Simonetta at mincom.com (Don.Simonetta@mincom.com) Date: Wed Aug 4 23:58:59 2004 Subject: [BNE-PM] cgi architecture Message-ID: Sorry for the late response on this one - I somehow missed it when it arrived. Just wanted to add that we have a situation where we use a similar architecture to that described by Derek below - only for completely different reasons. In our case its so that Internet access can run a process behind our firewall (to access an internal database via intranet CGI). -----Original Message----- From: owner-brisbane-pm-list@pm.org [mailto:owner-brisbane-pm-list@pm.org] On Behalf Of derek@wedgetail.com Sent: Friday, 20 September 2002 16:20 To: d.bussenschutt@mailbox.gu.edu.au Cc: brisbane-pm-list@happyfunball.pm.org Subject: Re: [BNE-PM] The Perl one-liner David Bussenschutt wrote: > I expect that I will eventually run in > mod_perl, but I haven't needed that yet (or figured it out either) ;-) > I think you're going to have to look at mod_perl before too long. I've never done any CGI/Web app stuff whatsoever, so I can't really say how easy that will be. Another approach would be to get all that work out of the CGI program, and into a server that sits on your machine permanently, and does all the "grunt work". So, your setup looks like this (set your fonts to "fixed width"!): +----------+ +--------------+ | CGI | CORBA/SOAP/adhoc protocol | Perl server | | "script" |---------------------------->| process | +----------+ +--------------+ So, your CGI script just connects to the server, passing the arguments, like say a cookie and some form fields, and gets back shiny new HTML to display. The server never dies, so not only is it "warmed up", but it can also cache database connections, keep those 6-12 sockets open for reuse, cache data from other sources, and so on ad infinitum. You can also move the server to a different, more powerful machine, or even replicate it across many machines! You can use any protocol you like, ranging from standard, like CORBA or SOAP (which has the advantage that you can switch the server to Java/Python/C++/C at will without writing a bunch of code), or just make up your own little ASCII protocol and use that. Anyway, even if you do use mod_perl, I think this design still has many benefits. -- D. -- This transmission is for the intended addressee only and is confidential information. If you have received this transmission in error, please delete it and notify the sender. The contents of this e-mail are the opinion of the writer only and are not endorsed by the Mincom Group of companies unless expressly stated otherwise. From d.bussenschutt at mailbox.gu.edu.au Thu Sep 26 03:54:31 2002 From: d.bussenschutt at mailbox.gu.edu.au (David Bussenschutt) Date: Wed Aug 4 23:58:59 2004 Subject: [BNE-PM] cgi architecture Message-ID: Well, for the moment, I'm doing OK, so we'll use the "suck-it-and-see" approach...if it's too slow, I'll re-engineer some of the communications. I must say that adding a local "daemon" (even if just to keep the sockets open the whole time) seems to me like a reasonably simple thing to do...I just relocate the functionality from my cgi into a daemon, wrap it into a while (1) loop, and wait for requests..... Hmmm I think I may consider this further...... but isn't that sort-of what mod_perl is supposed to allow me to do? anyway.... I wonder..... does anyone out there use mod_perl , and can give me some tips etc. (I think I need to read some more man pages too!) David. -------------------------------------------------------------------- David Bussenschutt Email: D.Bussenschutt@mailbox.gu.edu.au Senior Computing Support Officer & Systems Administrator/Programmer RedHat Certified Engineer. Member of Systems Administrators Guild of Australia. Location: Griffith University. Information Technology Services Brisbane Qld. Aust. (TEN bldg. rm 1.33) Ph: (07)38757079 -------------------------------------------------------------------- Don.Simonetta@mincom.com 26/09/2002 02:44 PM To: derek@wedgetail.com, d.bussenschutt@mailbox.gu.edu.au cc: Subject: RE: [BNE-PM] cgi architecture Sorry for the late response on this one - I somehow missed it when it arrived. Just wanted to add that we have a situation where we use a similar architecture to that described by Derek below - only for completely different reasons. In our case its so that Internet access can run a process behind our firewall (to access an internal database via intranet CGI). -----Original Message----- From: owner-brisbane-pm-list@pm.org [mailto:owner-brisbane-pm-list@pm.org] On Behalf Of derek@wedgetail.com Sent: Friday, 20 September 2002 16:20 To: d.bussenschutt@mailbox.gu.edu.au Cc: brisbane-pm-list@happyfunball.pm.org Subject: Re: [BNE-PM] The Perl one-liner David Bussenschutt wrote: > I expect that I will eventually run in > mod_perl, but I haven't needed that yet (or figured it out either) ;-) > I think you're going to have to look at mod_perl before too long. I've never done any CGI/Web app stuff whatsoever, so I can't really say how easy that will be. Another approach would be to get all that work out of the CGI program, and into a server that sits on your machine permanently, and does all the "grunt work". So, your setup looks like this (set your fonts to "fixed width"!): +----------+ +--------------+ | CGI | CORBA/SOAP/adhoc protocol | Perl server | | "script" |---------------------------->| process | +----------+ +--------------+ So, your CGI script just connects to the server, passing the arguments, like say a cookie and some form fields, and gets back shiny new HTML to display. The server never dies, so not only is it "warmed up", but it can also cache database connections, keep those 6-12 sockets open for reuse, cache data from other sources, and so on ad infinitum. You can also move the server to a different, more powerful machine, or even replicate it across many machines! You can use any protocol you like, ranging from standard, like CORBA or SOAP (which has the advantage that you can switch the server to Java/Python/C++/C at will without writing a bunch of code), or just make up your own little ASCII protocol and use that. Anyway, even if you do use mod_perl, I think this design still has many benefits. -- D. -- This transmission is for the intended addressee only and is confidential information. If you have received this transmission in error, please delete it and notify the sender. The contents of this e-mail are the opinion of the writer only and are not endorsed by the Mincom Group of companies unless expressly stated otherwise. From andrew at intervations.com.au Thu Sep 26 07:53:32 2002 From: andrew at intervations.com.au (Andrew Wild) Date: Wed Aug 4 23:58:59 2004 Subject: [BNE-PM] cgi architecture References: Message-ID: <3D93034C.9010806@intervations.com.au> I have used mod_perl quite a bit. I wrote the search engine I run, Search66.com in it (http://search66.com) and a currency conversion service we now sell called JAZConvert (http://jazconvert.com). There are many, many advantages to using mod_perl. One of them is persistant database connections. To do this is very simple if you are using DBI for the connections. When running under mod_perl, you simply have to replace your use DBI; statement with use Apache::DBI; and bingo - you have persistant connections. (I use this in both of the above we apps) What Apache::DBI does is intercepts your connect and disconnect calls. It overides this methods in DBI with its own - this is how it achieves the persistance. When a connect call is made, it has a look at its existing open database connections and compares the db name, username and password. If they all match, it then returns the database handle instead of opening a new one. But persistant DB connections are only one advantage of mod_perl. The other major benefit is speed. A major performance issue in CGI is that each time a Perl CGI script is called it has to first load up the Perl intrepreter and then intrepret the perl script. This takes time. However, mod_perl loads up the script in memory and wraps your entire script around a function call. Hence, when a call comes in to your script it doesn't load the Perl interpreter and intrepret the script, rather it simply executes the function call - hence, it is MUCH faster. HOWEVER, this causes your script to be called in a different namespace then what you may be used to. Hence, it is *very* important that you my all variables. use strict; is a MUST otherwise you will have lots of problems and memory leaks everywhere. Also, you should not use global variables unless you know what you are doing! Anyway, that is my 2c worth on mod_perl. :) From my experience, mod_perl has been invaluable in writing high performance web based scripts. However, saying this, PHP also has persistant DB connections now and it is also very good - but I'll leave that for another email. ;) Cheers, Andrew. David Bussenschutt wrote: > Well, for the moment, I'm doing OK, so we'll use the "suck-it-and-see" > approach...if it's too slow, I'll re-engineer some of the communications. > I must say that adding a local "daemon" (even if just to keep the sockets > open the whole time) seems to me like a reasonably simple thing to do...I > just relocate the functionality from my cgi into a daemon, wrap it into a > while (1) loop, and wait for requests..... Hmmm I think I may consider > this further...... but isn't that sort-of what mod_perl is supposed to > allow me to do? anyway.... I wonder..... does anyone out there use > mod_perl , and can give me some tips etc. (I think I need to read some > more man pages too!) > > David. > -------------------------------------------------------------------- > David Bussenschutt Email: D.Bussenschutt@mailbox.gu.edu.au > Senior Computing Support Officer & Systems Administrator/Programmer > RedHat Certified Engineer. > Member of Systems Administrators Guild of Australia. > Location: Griffith University. Information Technology Services > Brisbane Qld. Aust. (TEN bldg. rm 1.33) Ph: (07)38757079 > -------------------------------------------------------------------- > > > > > Don.Simonetta@mincom.com > 26/09/2002 02:44 PM > > > To: derek@wedgetail.com, d.bussenschutt@mailbox.gu.edu.au > cc: > Subject: RE: [BNE-PM] cgi architecture > > > Sorry for the late response on this one - I somehow missed it when it > arrived. > > Just wanted to add that we have a situation where we use a similar > architecture to that described by Derek below - only for completely > different reasons. In our case its so that Internet access can run a > process behind our firewall (to access an internal database via intranet > CGI). > > > -----Original Message----- > From: owner-brisbane-pm-list@pm.org > [mailto:owner-brisbane-pm-list@pm.org] On Behalf Of derek@wedgetail.com > Sent: Friday, 20 September 2002 16:20 > To: d.bussenschutt@mailbox.gu.edu.au > Cc: brisbane-pm-list@happyfunball.pm.org > Subject: Re: [BNE-PM] The Perl one-liner > > David Bussenschutt wrote: > > I expect that I will eventually run in > >>mod_perl, but I haven't needed that yet (or figured it out either) > > ;-) > > > I think you're going to have to look at mod_perl before too long. I've > never done any CGI/Web app stuff whatsoever, so I can't really say how > easy that will be. > > Another approach would be to get all that work out of the CGI program, > and into a server that sits on your machine permanently, and does all > the "grunt work". > > So, your setup looks like this (set your fonts to "fixed width"!): > > +----------+ +--------------+ > | CGI | CORBA/SOAP/adhoc protocol | Perl server | > | "script" |---------------------------->| process | > +----------+ +--------------+ > > So, your CGI script just connects to the server, passing the arguments, > like say a cookie and some form fields, and gets back shiny new HTML to > display. The server never dies, so not only is it "warmed up", but it > can also cache database connections, keep those 6-12 sockets open for > reuse, cache data from other sources, and so on ad infinitum. You can > also move the server to a different, more powerful machine, or even > replicate it across many machines! > > You can use any protocol you like, ranging from standard, like CORBA or > SOAP (which has the advantage that you can switch the server to > Java/Python/C++/C at will without writing a bunch of code), or just make > > up your own little ASCII protocol and use that. > > Anyway, even if you do use mod_perl, I think this design still has many > benefits. > > -- > D. > > > -- Managing Director e-JAZ Pty Ltd JAZConvert Currency Conversion Ph: +61 7 3201 0146 http://jazconvert.com andrew@e-jaz.com.au Search66 ~ Find it first time - every time! http://Search66.com "The only impossibility is that of believing there is none." From d.bussenschutt at mailbox.gu.edu.au Sun Sep 29 20:18:27 2002 From: d.bussenschutt at mailbox.gu.edu.au (David Bussenschutt) Date: Wed Aug 4 23:58:59 2004 Subject: [BNE-PM] Brisbane Perl Programmer wanted (for short-term contract) Message-ID: POSITION: PERL PROGRAMMER (UG / Graduate's OK) LOCATION: Nathan, Brisbane, Australia. PAYRATE: $22.76 / hr DETAILS: Section of Griffith University, Nathan Campus is seeking a Perl programmer to work on a project of approximately 1 month in length. The work is of strategic importance to the University. You would be manipulating data, generating reports, and involved in system development ( in Perl ). Full time availability preferred but hours can be negotiated around study for the right candidate. Immediate start. APPLICATION PROCEDURES: Please email your cover letter and resume to Karl Turnbull at K.turnbull@mailbox.gu.edu.au David. P.S. If you can write reasonable perl (you don't need to be a guru!), and you are in prisbane, this one's for you. We're not really fussy, as we need "immediate start", but you must know perl. Did I mention PERL.? P.P.S You can contact me directly for more technical info (see below), or send resume/CV to my supervisor at the above email address. -------------------------------------------------------------------- David Bussenschutt Email: D.Bussenschutt@mailbox.gu.edu.au Senior Computing Support Officer & Systems Administrator/Programmer RedHat Certified Engineer. Member of Systems Administrators Guild of Australia. Location: Griffith University. Information Technology Services Brisbane Qld. Aust. (TEN bldg. rm 1.33) Ph: (07)38757079 -------------------------------------------------------------------- From derek at wedgetail.com Sun Sep 29 21:06:09 2002 From: derek at wedgetail.com (Derek Thomson) Date: Wed Aug 4 23:59:00 2004 Subject: [BNE-PM] Brisbane Perl Programmer wanted (for short-term contract) References: Message-ID: <3D97B191.1010707@wedgetail.com> David Bussenschutt wrote: > DETAILS: Section of Griffith University, Nathan Campus is seeking > a Perl programmer to work on a project of approximately 1 month in length. > The work is of strategic importance to the University. You would be > manipulating data, generating reports, and involved in system development > ( in Perl ). And it has to be done in ONE LINE!! :) > P.S. If you can write reasonable perl (you don't need to be a guru!), and > you are in prisbane, this one's for you. We're not really fussy, as we > need "immediate start", but you must know perl. Did I mention PERL.? Let we get this straight - you're saying you need to know Perl? But I'm *still confused* Is that Perl, perl or PERL? :) This is in the FAQ somewhere. Basically, Perl is the language, perl is the interpreter, and PERL doesn't exist. Okay, PERL exists *now*. See the Inline::PERL module: http://search.cpan.org/author/JMCNAMARA/Acme-Inline-PERL-0.01/PERL.pm It's pretty funny. From the description of the module: Inline::PERL gives you the power of the PERL programming language from within your Perl programs. This gives you instant access to hundreds of pre-coded applications such as bulletin boards, hit counters and shopping carts. PERL is a programming language for writing CGI applications. It's main strength is that it doesn't have any unnecessary warnings or strictures. It is a direct descendent of Perl, a programming language which was used mainly by programmers. However, the original language required too much reading and thinking and so PERL was developed as a language which was more in tune with the requirements of the Internet age. You could *also* say that PERL (all upper case) is really pronounced PHP, if you wanted to take a cheap shot at PHP :) -- D.