writing to log from perl script

2002-11-06 Thread K Pfeiffer
Hi, I was reading up today on syslog and it gave the following shell script example of how to set up a logging service: $ logger -p local5.info "Script terminated normally" I was wondering what the best way might be to do this from a perl script that runs periodically - have it append directly

Re: The basics of SWITCH

2002-11-04 Thread K Pfeiffer
Gajo Csaba writes: > Hi, I have a problem with SWITCH. I wrote this, I think > it's clear to anzone what it should do: Just out of curiousity I typed in 'perldoc SWITCH' and 'perldoc -f SWITCH' and found nothing. What is it? (the short answer is fine) Thanks, Kevin -- Kevin Pfeiffer Internatio

Kmail, pipe, perl script, result?

2002-11-01 Thread K Pfeiffer
Hi, With KMail one can use a filter to pipe a message somewhere. I have a perl script that will parse a filtered message for a date and then (when run at the commandline) return a "user-readable" result. When I do this in KMail with a filter I never see the returned result. Is there a way (in t

the tilde and File::Spec?

2002-10-29 Thread K Pfeiffer
Hi, I as trying the File::Spec module mentioned in Learning Perl and noticed that it fails with a pathname like "~/perl_practice/myfile". I looked at "perldoc -q tilde" and it does mention a general problem with this. I this true with this module (or others) or did I just do something wrong? -

Re: Easy one [getting "OCT" from localtime]

2002-10-27 Thread K Pfeiffer
John W. Krahn writes: > Jeff 'Japhy' Pinyan wrote: [...] > > my $month = (split ' ', uc localtime)[1]; > > > > localtime(), in scalar context, returns a string like > > > > "Fri Oct 25 10:30:23 2002" > > > > I'm uppercasing it, splitting it on whitespace, and getting the 2nd > > element ("OCT")

Re: read from a file

2002-10-27 Thread K Pfeiffer
Vo, Synh writes: > I changed the code and still got errors. [...] > print NEW "grant select , update, delete, insert on " $item " > user;" ; [...] > syntax error at grant.pl line 13, near ""grant select , update, delete, > insert on " $item " > String found where operator expected at g

Re: breaking out of a loop? (when a condition changes)

2002-10-22 Thread K Pfeiffer
Michael Fowler writes: > On Tue, Oct 22, 2002 at 10:13:49PM +0200, K Pfeiffer wrote: > > My "if" loop > > "if" isn't a loop, it's a conditional. oops [...] > Why are you using redo here? "while" is a loop, it naturally, uh, loops. &g

breaking out of a loop? (when a condition changes)

2002-10-22 Thread K Pfeiffer
Hi Perl-Meisters, My "if" loop didn't work with "last" so I changed "if" to "while", but it seems that the "redo" doesn't cause the "while" to re-evaluate with the new value of $destfile. When I run this and type something other than "yes" I get the message "File foobar already exists..." (even

Re: parsing variable that contains a regex ("/findme/")

2002-10-21 Thread K Pfeiffer
John W. Krahn writes: > if ( $regex ) { > # is the string true in a boolean context? That makes sense (too bad I didn't think of it). So I guess my error message was complaining about my use of the three regular expression memory variables ($` $& $') which were then seen as being unused. > If y

parsing variable that contains a regex ("/findme/")

2002-10-20 Thread K Pfeiffer
Hi y'all, I have a little script that lets me test some regexes. For example at the prompt I type in: "\b(The|the)\b". I thought it would be better if I could also include the slashes and then modifiers such as 'g' and 'i': "/\bthe\b/i" (for example). So I modified it as below: --- m

Re: extra space in column (obvious answer but I can't find it)

2002-10-13 Thread K Pfeiffer
Elias Assmann writes: [...] > Let me guess: you printed them like print "@words"; -- right? When you > interpolate an array in double quotes, a space is inserted between > elements. Try it this: [...] Ja, das war es! (Thanks!) -- Kevin Pfeiffer <[EMAIL PROTECTED]> -- To unsubscribe, e-mail:

extra space in column (obvious answer but I can't find it)

2002-10-13 Thread K Pfeiffer
Hi Perl Gang, While doing one of the very basic exercises out of the beginning of Learning Perl I'm stuck: #!/usr/bin/perl -w use strict; my @words; print "Enter a list of words, one on each line (CTRL-D when complete): \n"; @words = ; I'm intentionally not chomping the words. I expect @words