[DLSLUG-Discuss] Perl

Mark Peirce e-mail addresses are not shown in archives
Sun Dec 4 09:00:16 EST 2005

After "Learning Perl", I recommend a copy of O'Reilly's "Perl Cookbook".  I
found it invaluable since examples work better than theory for me.  Oddly,
most everything I've ever needed to write has already been written by
someone else - and most of it is included in this book.

I also used the Perl debugger interactively to test various commands and
poke around inside of hashes.  The following command gives you a Perl shell
to play in, letting you enter snippets on the command line and debug
interactively.  Note that the debugger interface is so ugly that you will
want to hit it with a stick.  Type 'h' for help.

perl -de0

- Mark

-----Original Message-----
From: [e-mail addresses are not shown in archives]
[mailto:[e-mail addresses are not shown in archives]] On Behalf Of Roger
Sent: Sunday, December 04, 2005 4:57 AM
To: [e-mail addresses are not shown in archives]
Subject: Fwd: Re: [DLSLUG-Discuss] Perl

This is a response to James, but I kinda wanted to CC the rest of the group.
sorry about that


--- Roger <[e-mail addresses are not shown in archives]> wrote:

> Date: Sun, 4 Dec 2005 01:54:09 -0800 (PST)
> From: Roger <[e-mail addresses are not shown in archives]>
> Subject: Re: [DLSLUG-Discuss] Perl
> To: James Fogg <[e-mail addresses are not shown in archives]>
> I remember that book. That's a good book.
> Be careful though...
> It comes in two variations: Windows and non-Windows *IX platforms.
> (Hint: Here is yet another reason why I'm gravitating towards Linux/BSD.
> The perl port on Windows is lacking. )
> Someone such as you who knows BASIC and shell environments should pick up
perl quickly. If
> you've
> written hello world in BASIC, counted Fibonacci numbers in BASIC, written
long and ugly shell
> scripts, or used very cryptic regular expressions in grep, then you will
love Perl. Perl glues
> all
> of those features together nicely. 
> I tend to use Perl as a quick and dirty way to automate things that would
annoy me as an
> end-user.
> I tend to think of it as shell scripting on steriods. I wouldn't use Perl
to write complex
> client-side code. (I would use Java or C++ with GUI libaries.) 
> so...
> Read the UNIX/Linux version of that beginners book.
> Stay away from Windows's ports unless you're desperate.
> You'll write beautiful Linux/BSD Perl scripts that will ALMOST work on
Windows. (Some features
> don't quite work as advertised on the Windows port.)
> (If you want scripting on Windows, learn VBScript.)
> The manpages are extensive!!!!! (man perl, man perltoc, etc...)
> They don't do a good job of teaching the language, but they make great
reference guides. Use
> them
> WITH that book! 
> (I'm willing to sit down and explain what MY perl examples do after you've
read some of that
> beginners book! Once you understand the small scripts that I write, I
suggest talking to the
> other
> members for more complicated stuff. I'm just an amateur hacker.)
> I've attached a sample script. I've tested it on Mac OS X (or BSD). It
takes as a command-line
> parameter the name of a program that won't go away. You don't have to know
the pid of the
> program.
> The script finds the pid for you! It kills programs faster than the
"force-quit" command will. I
> use it whenever Netscape 7.1 chokes on the JavaScript code that Yahoo
uses. lol...
> Also, you can look over the other example Perl script that I recently sent
to the group.
> I expanded upon the Mozilla plugin for multi-media. 
> I made the pluggin "rc" file call my Perl script with the filename of a
temp file. That temp
> file
> may or may not have the correct filename extension. In the script, I use
the xmms tools to make
> the plugin play the midi files. I was feeling frustrated because I
couldn't make "timidity",
> "playmidi", and "xmms2" work on my Fedora system.
> Both of my Perl scripts are open source. Please read them before you use
them on your system.
> (Hint, hint...)
> -Roger
> --- James Fogg <[e-mail addresses are not shown in archives]> wrote:
> > At the late age of 42 I have a requirement to learn perl. To make
> > matters worse, I have little experience with any structured high level
> > languages other than BASIC (I have some Assembler experience for the
> > PDP-11 family though).
> > 
> > For those of you who know perl, if you had to learn it all over again,
> > how would you do it? I hear that O'Reilly's "Learning Perl" is a good
> > resource. Are there any "live" resources, like night courses? Is anyone
> > willing to tutor an older student?
> > 
> >  -James
> > _______________________________________________
> > DLSLUG-Discuss mailing list
> > [e-mail addresses are not shown in archives]
> > http://dlslug.org/mailman/listinfo/dlslug-discuss
> > 
> __________________________________________ 
> Yahoo! DSL - Something to write home about. 
> Just $16.99/mo. or less. 
> dsl.yahoo.com 
> > #!/usr/bin/perl
> $process_id = -999999;
> open(PROCESS_SEARCH,"ps aux|") || die "I couldn't read the process
> $done = 0;
> {
>         if ($_ =~ /$ARGV[0]/)
> 	{
> 		@working_tokens = split(/\s/,$_);
> 		@actual_tokens = ();
> 		foreach $single_token (@working_tokens)
> 		{
> 			if ($single_token =~ /\w+/)
> 			{
> 				push(@actual_tokens,$single_token);
> 			}
> 		}
> 		$process_id = $actual_tokens[1];
> 		printf "The process id for $ARGV[0] is $process_id.\n";
> 		last LINE;
> 	} 
> }
> close PROCESS_SEARCH || die "I couldn't close the process table.\n";
> if ($process_id == -999999)
> {
> 	exit;
> }
> kill SIGKILL, $process_id

Start your day with Yahoo! - Make it your home page! 

More information about the DLSLUG-Discuss mailing list