RE: how to stamp the date onto a log file name.

2001-05-10 Thread King, Jason
Peter Lemus writes .. >Please provide an example on how I can create the log >file of a perl script, something like MMDD.log. >I'll like to use the current Month, Day, and Year. well .. assuming that your program is only run once (ie. two copies can't be running at the same time - so there a

how to stamp the date onto a log file name.

2001-05-10 Thread Peter Lemus
Hi Guys, Please provide an example on how I can create the log file of a perl script, something like MMDD.log. I'll like to use the current Month, Day, and Year. thanks in advance, = Peter Lemus Computer Networks Engineer [EMAIL PROTECTED] My Dad always tought me; when you do good; exp

OT: Debian Users?

2001-05-10 Thread Stephen E. Hargrove
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I'm sorry to junk up the list with this, but if anyone out there is running a Debian Linux system, would you please contact me privately? I've managed to mangle the hell out of my dpkg-perl and I can't find anyone who can offer me any advice or assist

Re: Sorting

2001-05-10 Thread Me
> >I'd like our beginners to take home the message that you shouldn't optimize > >for performance until it's clear you need to. Otherwise you're just > >wasting programmer time. Premature optimization is the root of, etc. > > While I agree, it's a good idea to know why things are slow, and why >

RE: Sorting

2001-05-10 Thread Jeff Pinyan
On May 10, Peter Scott said: >At 05:55 PM 5/10/01 -0400, Jeff Pinyan wrote: >>That sorting method does a lot of work -- that is, it does things more >>than once. I suggest you use a schwarztian transform, or the Orcish >>manuever, to increase speed. > >I'd like our beginners to take home the mes

RE: Sorting

2001-05-10 Thread Peter Scott
At 05:55 PM 5/10/01 -0400, Jeff Pinyan wrote: >That sorting method does a lot of work -- that is, it does things more >than once. I suggest you use a schwarztian transform, or the Orcish >manuever, to increase speed. I'd like our beginners to take home the message that you shouldn't optimize fo

RE: Sorting

2001-05-10 Thread Jeff Pinyan
On May 10, Jeff Pinyan said: > { >my %cache; >@new = sort { > ($cache{$a}) = $a =~ /\@([^:]+)/ if not exists $cache{$a}; > ($cache{$b}) = $b =~ /\@([^:]+)/ if not exists $cache{$b}; > $cache{$a} cmp $cache{$b} >} @orig; } -- Jeff "japhy" Pinyan [EMAIL PROTEC

RE: Sorting

2001-05-10 Thread Jeff Pinyan
On May 10, Nic LAWRENCE said: >> > Can anybody suggest the most efficient method to do the following... >> > >> > I have an array of email aliases like the following: >> > [EMAIL PROTECTED]: sys >> > [EMAIL PROTECTED]: coookiecom >> > [EMAIL PROTECTED]:

RE: Sorting

2001-05-10 Thread Nic LAWRENCE
Oooo... I like that... more or less the same as Peter suggested but a little more self contained ... gonna have to remember that kinda structure. thnx i'll try it out :) > -Original Message- > From: Paul [mailto:[EMAIL PROTECTED]] > Sent: 10 May 2001 10:41 > To: Nic LAWRENCE; 'Beginner P

Re: Regexp Question

2001-05-10 Thread Paul
--- Carl Rogers <[EMAIL PROTECTED]> wrote: > Not having Perl up and running, would this work with the > parenthesis?? > $temp = ~ m/PT[\(]*(\w+)[\)]*/; > $value = $1; > I'm sure there is a one-line answer, but I'm too new to know. > > At 05:13 PM 5/10/2001 -0400, Gross, Stephan wrote: > >I w

RE: Regexp Question

2001-05-10 Thread Nic LAWRENCE
How about this? if (/PT\s*\(?(\w+)\)?/) { $value = $1; } PTMatches the PT \s* Matches any number (or no) spaces \(? Matches one or none ('s (\w+) Matches one or many word characters \)? Matches one or none )'s $1Value caught by (\w+) I think. .. .. maybe. > At 05:13 PM 5/10/20

RE: Sorting

2001-05-10 Thread Peter Cornelius
I don't know if this is "correct" but I would use sort and pass in a custom compare function. @sortedArray = sort { compareDomains() } @unsortedArray; sub compareDomains { my ($userA, $domainA) = split /@/, $a; my ($userB, $domainB) = split /@/, $a; return ($domainA cmp

Re: Sorting

2001-05-10 Thread Paul
--- Nic LAWRENCE <[EMAIL PROTECTED]> wrote: > Can anybody suggest the most efficient method to do the following... > > I have an array of email aliases like the following: > [EMAIL PROTECTED]: sys > [EMAIL PROTECTED]: coookiecom > [EMAIL PROTECTED]:

Re: Regexp Question

2001-05-10 Thread Carl Rogers
Not having Perl up and running, would this work with the parenthesis?? $temp = ~ m/PT[\(]*(\w+)[\)]*/; $value = $1; I'm sure there is a one-line answer, but I'm too new to know. At 05:13 PM 5/10/2001 -0400, Gross, Stephan wrote: >I want to match the following: >1) the letters "PT" >2) a space o

Re: check to see if file exists.

2001-05-10 Thread Paul
--- Peter Lemus <[EMAIL PROTECTED]> wrote: > Hi, I need to check to see if a file exists in a > directory, if it does then delete it, else .. > > is this the correct syntax? > > if (-e $file and -f _) { > system ("del $file") ? print "File $file deleted\n" > : warn "File $file WAS removed:

RE: check to see if file exists.

2001-05-10 Thread Nic LAWRENCE
Never seen system with that syntax before... here's what I'd do though: if (-e $file) { if (unlink $file) { warn "File $file WAS removed."; } } That's just my first guess though having not tested it. :) > -Original Message- > From: Peter Lemus [mailto:[EMAIL PROTECTED]] > Sent:

check to see if file exists.

2001-05-10 Thread Peter Lemus
Hi, I need to check to see if a file exists in a directory, if it does then delete it, else .. is this the correct syntax? if (-e $file and -f _) { system ("del $file") ? print "File $file deleted\n" : warn "File $file WAS removed: $!\n"; = Peter Lemus Computer Networks Engineer [EMAIL

Sorting

2001-05-10 Thread Nic LAWRENCE
Can anybody suggest the most efficient method to do the following... I have an array of email aliases like the following: [EMAIL PROTECTED]: sys [EMAIL PROTECTED]: coookiecom [EMAIL PROTECTED]: niccicamcom [EMAIL PROTECTED]: katyland-

Regexp Question

2001-05-10 Thread Gross, Stephan
I want to match the following: 1) the letters "PT" 2) a space or nothing 3) a word that may or may not be in parentheses or even not exist and return item #3 (which may be null) Example: PT (XYZ) or PT XYZ or PTXYZ or PT should return "XYZ" except the last case, which should return "". I can do

Re: Breaking up a file.

2001-05-10 Thread Me
#!/usr/bin/perl -w use strict; while (<>) # lines from stdout or files listed on command line { # are read one at a time and put into $_ /\|/ and print# print lines with '|' in them or # only executed if previous expression false

Re: Breaking up a file.

2001-05-10 Thread Tirthankar C.P
Many thanks to Paul. His solution works. -tir On Thu, 10 May 2001, Paul wrote: > > --- "Tirthankar C.P" <[EMAIL PROTECTED]> wrote: > > > > Folks, I have a file like this: > > > > Asea Brown Boveri Ltd. > > 02-Aug-1999 | 02-Aug-1999 | 399.05 > > 03-Aug-1999 | 03-Aug-1999 | 395.00 >

Re: Breaking up a file.

2001-05-10 Thread Paul
--- "Tirthankar C.P" <[EMAIL PROTECTED]> wrote: > > Folks, I have a file like this: > > Asea Brown Boveri Ltd. > 02-Aug-1999 | 02-Aug-1999 | 399.05 > 03-Aug-1999 | 03-Aug-1999 | 395.00 > 04-Aug-1999 | 04-Aug-1999 | 426.5 > 06-Aug-1999 | 06-Aug-1999 | 406.00 > 31-Jul-2000 | 31-

Re: hex conversion

2001-05-10 Thread Jeff Pinyan
On May 10, Paul Cotter said: >print dtcnvx('Ab c') # gives 41622063 Ohh. Oops. $x = unpack 'H*', 'Ab c'; -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ Are you a Monk? http://www.perlmonks.com/ http://forums.perlguru.com/ Perl Programmer

Re: hex conversion

2001-05-10 Thread Paul
--- Paul Cotter <[EMAIL PROTECTED]> wrote: > From: "Jeff Pinyan" <[EMAIL PROTECTED]> > > On May 10, Paul Cotter said: > > >What combination of sprintf/pack/upack/asc/hex/xyz.pm etc will > > > allow me to convert a string in to a string hex equivalent. > > > I dare say, in Perl's little quirks the

Re: hex conversion

2001-05-10 Thread Brett W. McCoy
On Thu, 10 May 2001, Paul Cotter wrote: > Something like > > print dtcnvx('Ab c') # gives 41622063 Use printf or sprintf and %x in your format string to convert something to a hex value. -- Brett The important thing

Breaking up a file.

2001-05-10 Thread Tirthankar C.P
Folks, I have a file like this: Asea Brown Boveri Ltd. 02-Aug-1999 | 02-Aug-1999 | 399.05 03-Aug-1999 | 03-Aug-1999 | 395.00 04-Aug-1999 | 04-Aug-1999 | 426.5 06-Aug-1999 | 06-Aug-1999 | 406.00 31-Jul-2000 | 31-Jul-2000 | 203.00 01-Aug-2000 | 01-Aug-2000 | 203.65 | Overa

Re: hex conversion

2001-05-10 Thread Paul Cotter
From: "Jeff Pinyan" <[EMAIL PROTECTED]> > On May 10, Paul Cotter said: > > >What combination of sprintf/pack/upack/asc/hex/xyz.pm etc will allow me > >to convert a string in to a string hex equivalent. I dare say, in Perl's > >little quirks there is an arcane subroutine called something like d

Re: hex conversion

2001-05-10 Thread Jeff Pinyan
On May 10, Paul Cotter said: >What combination of sprintf/pack/upack/asc/hex/xyz.pm etc will allow me >to convert a string in to a string hex equivalent. I dare say, in Perl's >little quirks there is an arcane subroutine called something like dtcnvx >that does just what I want... Sadly, the oct(

hex conversion

2001-05-10 Thread Paul Cotter
Hi What combination of sprintf/pack/upack/asc/hex/xyz.pm etc will allow me to convert a string in to a string hex equivalent. I dare say, in Perl's little quirks there is an arcane subroutine called something like dtcnvx that does just what I want... Something like print dtcnvx('Ab c') #

Re: Regexp: Grouping and replacing with an unknown number of groups

2001-05-10 Thread Paul
--- Craig Moynes/Markham/IBM <[EMAIL PROTECTED]> wrote: > [snip . . . ] > The number of mini-regexp differs depending on the date format line > the user enters. So i find out how make keys there are (thus the > number of mini-regexps) and try to construct a string that will print > out whatever

Re: beginner here - with basic cgi trouble

2001-05-10 Thread Jeff Pinyan
On May 10, David A. Desrosiers said: > >>It didn't work ... >>the reason .. Attack of the ^M 's > > perl is your friend: > > perl -pi -e 's#\r\n#\n#g' formail.pl Why use s/// if you don't have to? japhy% perl -pi -e 'tr/\r//d' files... Why use Perl if you don't have to?

Re: beginner here - with basic cgi trouble

2001-05-10 Thread Brett W. McCoy
On Thu, 10 May 2001, Xun_Dog wrote: >The last script I downloaded for use was >a formail.pl (std stuff from a Perl archive on the Web) > >I had to configure it . i.e. @referrers etc. ... > >It didn't work ... > >the reason .. Attack of the ^M 's > > > open up these scri

Re: beginner here - with basic cgi trouble

2001-05-10 Thread David A. Desrosiers
>It didn't work ... >the reason .. Attack of the ^M 's perl is your friend: perl -pi -e 's#\r\n#\n#g' formail.pl /d

Re: beginner here - with basic cgi trouble

2001-05-10 Thread Xun_Dog
Yo Chip, The last script I downloaded for use was a formail.pl (std stuff from a Perl archive on the Web) I had to configure it . i.e. @referrers etc. ... It didn't work ... the reason .. Attack of the ^M 's open up these scripts with fox-editor if you have it and se

Re: beginner here - with basic cgi trouble

2001-05-10 Thread Chip Wiegand
-- Original Message -- From: Matt Cauthorn <[EMAIL PROTECTED]> Date: Thu, 10 May 2001 08:43:34 -0700 (PDT) >Chip -- try this in your cgi bin. Type perldoc CGI for more info. > > #!/usr/bin/perl -w > use CGI qw/:standard/; > print header, > start_html(

Re: beginner here - with basic cgi trouble

2001-05-10 Thread Matt Cauthorn
Chip -- try this in your cgi bin. Type perldoc CGI for more info. #!/usr/bin/perl -w use CGI qw/:standard/; print header, start_html('hello world'), h1('hello world'), end_html; -- Cgi.pm makes everything easy. In your code below, you fogot to put the first tag... ---

Re: beginner here - with basic cgi trouble

2001-05-10 Thread Chip Wiegand
-- Original Message -- From: "Brett W. McCoy" <[EMAIL PROTECTED]> Date: Thu, 10 May 2001 09:39:29 -0400 (EDT) >On Thu, 10 May 2001, Chip Wiegand wrote: > >> I have the permissions set to 755, so it should be executable. When I >> try ./formparser.cgi I get

Re: Taint flag

2001-05-10 Thread Jeff Pinyan
On May 10, Peter Cline said: >When attempt to use the taint flag I get the following complaint when >invoking perl from a command line (using -c, -w, and -wc): > >Too late for "-T" option at survey_select.pl line 1. > >The code runs however, and does what is expected. Just curious if anyone >k

Taint flag

2001-05-10 Thread Peter Cline
When attempt to use the taint flag I get the following complaint when invoking perl from a command line (using -c, -w, and -wc): Too late for "-T" option at survey_select.pl line 1. The code runs however, and does what is expected. Just curious if anyone knows what this means. Thanks, P

Re: New to Perl

2001-05-10 Thread Jeff Pinyan
On May 10, Peter Scott said: >At 09:29 AM 5/10/2001 -0400, Kevin Meltzer wrote: >>On Thu, May 10, 2001 at 09:17:30AM -0400, Jeff Pinyan ([EMAIL PROTECTED]) >>spew-ed forth: >> > On May 10, Crandell, Daniel (TIFPC) said: >> > >> > >Same situation here on this end. Buy oreilly book, "mastering re

Re: New to Perl

2001-05-10 Thread Peter Scott
At 09:29 AM 5/10/2001 -0400, Kevin Meltzer wrote: >On Thu, May 10, 2001 at 09:17:30AM -0400, Jeff Pinyan ([EMAIL PROTECTED]) >spew-ed forth: > > On May 10, Crandell, Daniel (TIFPC) said: > > > > >Same situation here on this end. Buy oreilly book, "mastering regular > > >expressions" 34.95 barnes

Thanks

2001-05-10 Thread Soin, Harinder
Thanks all for all your replies. I will be on my way soon Regards Harry

Re: beginner here - with basic cgi trouble

2001-05-10 Thread Brett W. McCoy
On Thu, 10 May 2001, Chip Wiegand wrote: > I have the permissions set to 755, so it should be executable. When I > try ./formparser.cgi I get ./formparser.cgi: not found, but when I > run perl formparser.cgi it runs fine. I noticed when doing ls -la that > the four scripts in the cgi-bin all have

Re: New to Perl

2001-05-10 Thread Kevin Meltzer
On Thu, May 10, 2001 at 09:17:30AM -0400, Jeff Pinyan ([EMAIL PROTECTED]) spew-ed forth: > On May 10, Crandell, Daniel (TIFPC) said: > > >Same situation here on this end. Buy oreilly book, "mastering regular > >expressions" 34.95 barnes and noble, it has picture of the owl. > > *THAT* is the re

Re: beginner here - with basic cgi trouble

2001-05-10 Thread Chip Wiegand
It appears "Brett W. McCoy" <[EMAIL PROTECTED]>, on Wed, 9 May 2001 06:06:37 -0400 (EDT) wrote something like: > On Tue, 8 May 2001, Chip Wiegand wrote: > > > - server log - > > [error](2)No such file or directory. exec of /usr/local/apache/cgi-bin/ > > formparser.cgi failed > > [error][192.

Re: New to Perl

2001-05-10 Thread Brett W. McCoy
On Thu, 10 May 2001, Jeff Pinyan wrote: > I am writing a book, "Learning Perl Regular Expressions", which is being > updated online nearly every evening, at: Cool! Do you have a publisher yet? -- Brett http://www.chapelperilous.net/btfwk/

Re: beginner here - with basic cgi trouble

2001-05-10 Thread Chip Wiegand
It appears "Brett W. McCoy" <[EMAIL PROTECTED]>, on Wed, 9 May 2001 23:30:56 -0400 (EDT) wrote something like: > On Thu, 10 May 2001, lemoninsz wrote: > > > hi,i have the same problem,when i do ./emailupload.cgi,error like this: > > "bash: ./emailupload.cgi: No such file or directory" > > > > th

Re: New to Perl

2001-05-10 Thread Brett W. McCoy
On Thu, 10 May 2001, Soin, Harinder wrote: > I am new to perl and I am qucikly realizing that a solid understanding of > Regular Expressions is a necessacity. Can anyone point me a good source > where I can go from zero to 100 miles in a short period of time. Also, if > anyone can give me some in

RE: New to Perl

2001-05-10 Thread Jeff Pinyan
On May 10, Crandell, Daniel (TIFPC) said: >Same situation here on this end. Buy oreilly book, "mastering regular >expressions" 34.95 barnes and noble, it has picture of the owl. *THAT* is the reason I am writing my book. J. Friedl is not going to be working on the second edition of that book,

Re: beginner here - with basic cgi trouble

2001-05-10 Thread Chip Wiegand
It appears Xun_Dog <[EMAIL PROTECTED]>, on Thu, 10 May 2001 06:01:07 -0400 wrote something like: > Yo Chip, >The last script I downloaded for use was >a formail.pl (std stuff from a Perl archive on the Web) >I had to configure it . i.e. @referrers etc. ... >It didn't work .

Re: New to Perl

2001-05-10 Thread Jeff Pinyan
On May 10, Soin, Harinder said: >I am new to perl and I am qucikly realizing that a solid understanding of >Regular Expressions is a necessacity. Can anyone point me a good source >where I can go from zero to 100 miles in a short period of time. That sounds dangerous. Regexes are something you

Re: IDE for perl?

2001-05-10 Thread Gary Stainburn
On Wednesday 09 May 2001 6:24 pm, Brett W. McCoy wrote: [snip] > > Of course, you can also use emacs on Windows -- it has everything you > describe (syntax highlighting, search and replace, etc). > You can also get VIM for windows - I use it when I HAVE to use windows which thankfully isn't ver

Re: Traversing a directory tree

2001-05-10 Thread Joe Yates
At 04:38 PM 10-05-01 +0530, Amarnath Honnavalli Anantharamaiah wrote: >Ho do I traverse the directory tree and find the file present in it. >I mean I should have an output similar to find command in shell. > >e.g find . -name lock -print Find("/etc", "abcd"); sub Find($$) { my ($sPath, $sM

RE: Traversing a directory tree

2001-05-10 Thread Sandeep Vaidya (LMI)
This is from 'Perl Cookbook': use File::Find; sub process_file { # do whatever; } find (\&process_file, @DIRLIST); Sandeep -Original Message- From: Amarnath Honnavalli Anantharamaiah [mailto:[EMAIL PROTECTED]] Sent: 10 May 2001 13:11 To: Perl Subject: RE: Traversing a directory tr

New to Perl

2001-05-10 Thread Soin, Harinder
Hello All, I am new to perl and I am qucikly realizing that a solid understanding of Regular Expressions is a necessacity. Can anyone point me a good source where I can go from zero to 100 miles in a short period of time. Also, if anyone can give me some info in the DBI module of perl, I will app

Re: beginner here - with basic cgi trouble

2001-05-10 Thread Matt Cauthorn
Type "which perl" at the command line to see the path to your perl interpreter. --- "Brett W. McCoy" <[EMAIL PROTECTED]> wrote: > On Thu, 10 May 2001, lemoninsz wrote: > > > hi,i have the same problem,when i do ./emailupload.cgi,error like this: > > "bash: ./emailupload.cgi: No such file or dir

RE: Traversing a directory tree

2001-05-10 Thread Amarnath Honnavalli Anantharamaiah
I tried using the File::Find, but I could not trace out the usage properly. Amar -Original Message- From: Amarnath Honnavalli Anantharamaiah [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 10, 2001 4:38 PM To: Perl Subject:Traversing a directory tree Ho do I traverse the

Re: Apache

2001-05-10 Thread Barry Elk
You have not told Apache that cgi's are present in that directory. I have modified your below by adding execCGI to Options # # "C:/Programme/Apache Group/Apache/cgi-bin" should be changed to whatever your ScriptAliased # CGI directory exists, if you have that configured. # AllowOverride N

Traversing a directory tree

2001-05-10 Thread Amarnath Honnavalli Anantharamaiah
Ho do I traverse the directory tree and find the file present in it. I mean I should have an output similar to find command in shell. e.g find . -name lock -print Thanks in advance Amar

Re: Apache

2001-05-10 Thread Me
> Forbidden http://httpd.apache.org/docs/misc/FAQ-E.html#forbidden