Re: pattern extraction

2004-08-17 Thread Gunnar Hjalmarsson
JupiterHost.Net wrote: you likely need the multi line switch. change this: my ($mso) = $row[2] =~ /(MS\d\d-\d\d\d)/i; to: my ($mso) = $row[2] =~ /(MS\d\d-\d\d\d)/si; The /s makes it match through multi lines. No, no, your understanding of the /s modifier appears to be a misconception. It changes

Re: a bug of "-f" option?

2004-08-17 Thread Gunnar Hjalmarsson
Shu Hung wrote: > I recently wrote a script with a '-f' file test inside. > > Normally, a '-f ' returns TRUE if a file with that > filename exist. My script returns TRUE for all the files -- except > the largest one (9.7 GB) on my list (others are XX MB - XXX MB in > size). Whenever I test it with

Catching signals

2004-08-17 Thread Ohad Ohad
Hi, can you please show me an example of the following signal catching scenario: 1. First Ctrl-C => Just warn and wait for a key-stroke, if any key other then Ctrl-C is presses, continue with the program. 2. If Ctrl-C was pressed again => Try to die gracefully, meaning do some cleanup before dyi

Re: date format

2004-08-17 Thread Gunnar Hjalmarsson
[EMAIL PROTECTED] wrote: I have this code: my ($month, $day, $year) = (localtime)[4,3,5]; printf ("%02d/%02d/%02d\n", $month+1,$day,$year+1900); which gives me 08/16/2004 what I want is 08/16/04. "perldoc -f localtime" describes very clearly how you get a two digit year. It's advisable to study th

Re: a bug of "-f" option?

2004-08-17 Thread Jose Alves de Castro
On Tue, 2004-08-17 at 10:18, Gunnar Hjalmarsson wrote: > Shu Hung wrote: > > I recently wrote a script with a '-f' file test inside. > > > > Normally, a '-f ' returns TRUE if a file with that > > filename exist. My script returns TRUE for all the files -- except > > the largest one (9.7 GB) on my

How to get contents of the clipboard

2004-08-17 Thread Ramprasad A Padmanabhan
Hi all, I am trying to write a perl script that requires the content of the clipboard. Is there a way I can do this? I am using Redhat AS 3 linux with a KDE desktop and Klipper Thanks Ram -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: Catching signals

2004-08-17 Thread Jim
> Hi, can you please show me an example of the following signal > catching > scenario: > 1. First Ctrl-C => Just warn and wait for a key-stroke, if > any key other > then Ctrl-C is presses, continue with the program. > 2. If Ctrl-C was pressed again => Try to die gracefully, > meaning do some > cle

RE: pattern extraction

2004-08-17 Thread Bob Showalter
Fontenot, Paul wrote: > Yes I have. The following URL's are the exact data from the database. Bottom post, please! > > I can get the MS??-??? from this URL > href="http://www.microsoft.com/technet/security/bulletin/MS03-051.asp"; > target="_default">Microsoft Security Bulletin MS03-051 > > But

Re: a bug of "-f" option?

2004-08-17 Thread Paul Johnson
On Tue, Aug 17, 2004 at 12:17:53PM +0800, Shu Hung (Koala) wrote: > I recently wrote a script with a '-f' file test inside. > > Normally, a '-f ' returns TRUE if a file with that filename > exist. My script returns TRUE for all the files -- except the largest > one (9.7 GB) on my list (others are

Re: pattern extraction

2004-08-17 Thread JupiterHost.Net
Gunnar Hjalmarsson wrote: JupiterHost.Net wrote: you likely need the multi line switch. change this: my ($mso) = $row[2] =~ /(MS\d\d-\d\d\d)/i; to: my ($mso) = $row[2] =~ /(MS\d\d-\d\d\d)/si; The /s makes it match through multi lines. No, no, your understanding of the /s modifier appears to be a

Re: how do I handle filenames that have parens?

2004-08-17 Thread Ken Wolcott
Randal; Thanks for answer I really needed to hear. Ken On Fri, 2004-08-13 at 18:36, Randal L. Schwartz wrote: > > "Luke" == Luke Bakken <[EMAIL PROTECTED]> writes: > > Luke> The simple solution is to be sure that single quotes are around the > Luke> strings passed to the "describe" comman

Re: pattern extraction

2004-08-17 Thread Gunnar Hjalmarsson
JupiterHost.Net wrote: Gunnar Hjalmarsson wrote: JupiterHost.Net wrote: you likely need the multi line switch. change this: my ($mso) = $row[2] =~ /(MS\d\d-\d\d\d)/i; to: my ($mso) = $row[2] =~ /(MS\d\d-\d\d\d)/si; The /s makes it match through multi lines. No, no, your understanding of the /s modi

date calculations

2004-08-17 Thread DBSMITH
All, If I wanted to subtract 1 from a date on the 1st of any month what module will reflect the correct date? For example, system time is 09.01.04 and I want data from 08.31.04, I would have to subtract 1 day. Which module do I need to install? thanks, derek

globals

2004-08-17 Thread Fontenot, Paul
After searching through the Perl Bookshelf CD, I have found that you can declare a global and then use local() to change that value for a block of code. I haven't found how to use a value from within a block of code outside that block of code though. Is this possible? I'm sure I just don't know wha

Re: globals

2004-08-17 Thread Wiggins d Anconia
> After searching through the Perl Bookshelf CD, I have found that you can > declare a global and then use local() to change that value for a block > of code. I haven't found how to use a value from within a block of code > outside that block of code though. Is this possible? I'm sure I just > don'

Re: date calculations

2004-08-17 Thread David Greenberg
Date::Manip from CPAN -David On Tue, 17 Aug 2004 12:50:16 -0400, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > All, > > If I wanted to subtract 1 from a date on the 1st of any month what module > will reflect the correct date? For example, system time is 09.01.04 and I > want data from 08.31.0

Re: globals

2004-08-17 Thread David Greenberg
If you really want to use a BAD method, which you should NOT use: while (...) { $total = $row[0]; ... } print $total . "\n"; What you SHOULD do is: use strict; ... my $total = ""; while (...) { $total = $row[0]; ... } print $total . "\n"; -David On Tue, 17 Aug 2004 10:55:25

RE: date calculations

2004-08-17 Thread Yacketta, Ronald
## ## ### ### FUNCTION NAME ### -- ### DateMinusX() ### ### PURPOSE: ### ### Return a date that is X number of days ago ### ### RETURN VALUE:Comment: ###

Can't kill forked grandchildren when running from shell script

2004-08-17 Thread Adam Rosi-Kessel
I'm not sure if beginners is the most appropriate place for this question; if not, please suggest another list. My perl script forks and the child is subsequently replaced by another (non-Perl) program with exec(). That child has its own subprocess. In response to certain events, the parent

Re: date calculations

2004-08-17 Thread Gunnar Hjalmarsson
David Greenberg wrote: [EMAIL PROTECTED] wrote: If I wanted to subtract 1 from a date on the 1st of any month what module will reflect the correct date? For example, system time is 09.01.04 and I want data from 08.31.04, I would have to subtract 1 day. Which module do I need to install? Date::Man

A --- What this kind of meaning is ?

2004-08-17 Thread Bee
Through out the perldoc, I always see something like this : B, F. something like that, would anybody tell me what this kind of thing is ? or any reference I can know more about this kind of phrases are ? TIA

Re: A --- What this kind of meaning is ?

2004-08-17 Thread Gunnar Hjalmarsson
Bee wrote: > Through out the perldoc, I always see something like this : B, > F. something like that, would anybody tell me what > this kind of thing is ? or any reference I can know more about this > kind of phrases are ? perldoc perlpod -- Gunnar Hjalmarsson Email: http://www.gunnar.cc

config from file

2004-08-17 Thread peery
Hi all, newbie question: I've got this .pl that has variables hard coded in it, and I need to draw these form a file instead... Here's roughly what I've got, how can I get the variables from a file in stead? my %ldap_hosts =("SOME_ENVIRONMENT_NAME" => "server.somename.org", "AN

RE: config from file

2004-08-17 Thread Wagner, David --- Senior Programmer Analyst --- WGO
[EMAIL PROTECTED] wrote: > Hi all, newbie question: I've got this .pl that has variables hard > coded in it, and I need to draw these form a file instead... Here's > roughly what I've got, how can I get the variables from a file in > stead? > > my %ldap_hosts =("SOME_ENVIRONMENT_NAME" => "serv

Re: config from file

2004-08-17 Thread Chris Devers
On Tue, 17 Aug 2004 [EMAIL PROTECTED] wrote: So how do I read this in? I know I need to open the file, etc etc etc.. I was thinking I need: open(CONF, ">$CONFFileName") || die "ERROR: could not open $CONFFileName, $!\n"; Opening a file with the '>' means "overwrite the existing contents". This p

Re: date calculations

2004-08-17 Thread DBSMITH
so is the shift or 0 statement doing the opposite of push / pop calls do? shift deletes elements of a list or an array? $x = (2,3,4); $y = shift ($x);# y is now 3,4 why is the or 0 needed b/c with just my $days = 0 the whole subroutine does not work ! ! ?? Derek B. Smith

Re: date calculations

2004-08-17 Thread DBSMITH
one more thing, shouldn't my $time = time; be local $time = time; even though my is safer and faster, local can be used globally and called from within any subroutine? thank you, Derek B. Smith OhioHealth IT UNIX / TSM / EDM Teams Gunnar Hjalmarsson <[EMAIL PROTECTED]> 08/17/2004 01:4

using DB_BTREE on an 8mm record file

2004-08-17 Thread Rob Benton
I've been using the DB_File $DB_BTREE module to create groups and sort them on an 8 million record file. Is there a faster way to do this or am I still getting pretty good perfomance with this module? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED

RE: date calculations

2004-08-17 Thread Charles K. Clarkson
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: : Gunnar Hjalmarsson <[EMAIL PROTECTED]> wrote: : : : Personally I don't know which of all the date related modules : : that would fit best, but I'm sure others do. I for one wouldn't : : use any module: : : : : my $time = time; : : : : sub m

RE: Can't kill forked grandchildren when running from shell script

2004-08-17 Thread Jim
> My perl script forks and the child is subsequently replaced by another > (non-Perl) program with exec(). That child has its own subprocess. > > In response to certain events, the parent tries to kill the child (and > its children). > > Currently, my method for doing this is: > > local $SIG{HU

Re: a bug of "-f" option?

2004-08-17 Thread Jenda Krynicky
From: "Shu Hung (Koala)" <[EMAIL PROTECTED]> > I recently wrote a script with a '-f' file test inside. > > Normally, a '-f ' returns TRUE if a file with that filename > exist. My script returns TRUE for all the files -- except the largest > one (9.7 GB) on my list (others are XX MB - XXX MB in siz

Re: using DB_BTREE on an 8mm record file

2004-08-17 Thread Chris Devers
On Tue, 17 Aug 2004, Rob Benton wrote: I've been using the DB_File $DB_BTREE module to create groups and sort them on an 8 million record file. Is there a faster way to do this or am I still getting pretty good perfomance with this module? What performance are you getting now? Try benchmarking y

RE: date calculations

2004-08-17 Thread Charles K. Clarkson
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: : Gunnar Hjalmarsson <[EMAIL PROTECTED]> wrote: : : : Personally I don't know which of all the date related : : modules that would fit best, but I'm sure others do. I : : for one wouldn't use any module: : : : : my $time = time; : : : : sub mydate

RE: globals

2004-08-17 Thread Charles K. Clarkson
Fontenot, Paul <[EMAIL PROTECTED]> wrote: : EXAMPLE: : : while (my(@row) = $sth1->fetchrow_array) : { : my ($total) = $row[0]; : print "Total Scanned:\t $total\n"; : } : : print "Total:\t $total\n"; : : After searching through the Perl Bookshelf CD

Re: Can't kill forked grandchildren when running from shell script

2004-08-17 Thread Adam Rosi-Kessel
On Tue, Aug 17, 2004 at 05:38:53PM -0400, Jim wrote: > > My perl script forks and the child is subsequently replaced by another > > (non-Perl) program with exec(). That child has its own subprocess. > > > > In response to certain events, the parent tries to kill the child (and > > its children). >

RE: Can't kill forked grandchildren when running from shell script

2004-08-17 Thread Jim
> Yes, I have the Perl Cookbook. I think I've read and tried all the > relevant recipes from there, but I'm still unable to kill > grandchildren > when the child's output is redirected to /dev/null and the > parent is run > from a shell script. > > Here's the basic code simplified a bit for illus

Re: date calculations

2004-08-17 Thread Gunnar Hjalmarsson
Charles K. Clarkson wrote: [EMAIL PROTECTED] wrote: Gunnar Hjalmarsson wrote: Personally I don't know which of all the date related modules that would fit best, but I'm sure others do. I for one wouldn't use any module: my $time = time; sub mydate { my $days = (shift or 0);

Re: A --- What this kind of meaning is ?

2004-08-17 Thread Bee
O! Thanks alot, that just simply the formatting codes, simple ! Thank you. - Original Message - From: "Gunnar Hjalmarsson" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, August 18, 2004 2:11 AM Subject: Re: A --- What this kind of meaning is ? > Bee wrote: > > Through ou