Re: alarm(x) question.

2003-07-11 Thread Ramprasad
[EMAIL PROTECTED] wrote: I'm kind of new to Perl, so please forgive the question.. I'm trying to use perl to read a file and then run a program using the file. I also want to use the alarm(x) function to skip to the next entry in the files if it times out. Here's what Ive go so far: open (TESTF

Re: match count

2003-07-11 Thread Jeff 'japhy' Pinyan
On Jul 7, David Storrs said: >> What the \K does is make the regex think it JUST started matching, so >> instead of replacing a bunch of stuff plus some extra fluff with the >> original bunch of stuff, we just say "after you've matched X, pretend you >> started matching HERE." It comes in handy i

Re: regexpr

2003-07-11 Thread Martin Costello
Thanks again - that "/eg" opens up a whole world of possibilities! John W. Krahn wrote: q() is another way of saying ''. All the quote operators can be found in the perlop.pod document under "Quote and Quote-like Operators" section. If you want your version to work correctly you are going to hav

Re: How to invoke the Linux KDE browser?

2003-07-11 Thread Frank B. Ehrenfried
I am going through a chapter in a perl text on cgi - trying to master it. Appartently, I need to transfer a cgi script to the ISP's server, then invoke it with the browser. Since my ISP does not allow cgi scripts to be run on their server, I have wriiten a perl script (see below) that executes

alarm(x) question.

2003-07-11 Thread denis
I'm kind of new to Perl, so please forgive the question.. I'm trying to use perl to read a file and then run a program using the file. I also want to use the alarm(x) function to skip to the next entry in the files if it times out. Here's what Ive go so far: open (TESTFILE, "< regression") || d

Re: joining keys

2003-07-11 Thread Rob Dixon
Kevin Pfeiffer wrote: > In article <[EMAIL PROTECTED]>, Rob Dixon > wrote: > > > Well done Kevin! > > > > Just a couple of points. > > Am I surprised? ;-) > > > > sub pad_keys { > > >my $ref = shift; > > >if (ref $ref eq "HASH") { > > > for my $value (%$ref) { > > > > This will loop o

Re: joining keys

2003-07-11 Thread Rob Dixon
Rob Dixon wrote: > John W. Krahn wrote: > > Rob Dixon wrote: > > > > > > Well done Kevin! > > > > > > Just a couple of points. > > > > > > Kevin Pfeiffer wrote: > > > > > > > > (I noticed that, too.) But thanks to your tip I think I've > > > > created my first recursive sub-routine (only tested on

Re: joining keys

2003-07-11 Thread Rob Dixon
John W. Krahn wrote: > Rob Dixon wrote: > > > > Well done Kevin! > > > > Just a couple of points. > > > > Kevin Pfeiffer wrote: > > > > > > (I noticed that, too.) But thanks to your tip I think I've > > > created my first recursive sub-routine (only tested on this > > > example). If it does what th

Re: regexpr

2003-07-11 Thread John W. Krahn
Martin Costello wrote: > > John W. Krahn wrote: > > > >Here is one way to do it: > > > >$ perl -e' > >$text = q/ > > > >blahblah -blah blah > >-blah blah -blah $blah -blah "Ground" > >-c "blah transformC" transformC; > > > >blahblah > >-af transformC"blah"($blah) > >-af Atr

Re: regexpr

2003-07-11 Thread Martin Costello
John, Thank you ever so much - that seemed to work. In my code I'm actually using variables for the names to replace: so my substitute looks like this : $line =~ s/("[^"]+"|\w+)/ $1 eq $oldList[$i] ? $newList[$i] : $1 eq "$oldList[$i]" ? "$newList[$i]" : $1 /eg; (I removed the q( ) parts from y

Re: joining keys

2003-07-11 Thread Steve Grazzini
On Fri, Jul 11, 2003 at 02:17:52PM -0700, John W. Krahn wrote: > Rob Dixon wrote: > > sub pad_keys { > > foreach (keys %$ref) { > > pad_keys($ref->{$_}); > > next unless (my $new = $_) =~ tr/ /_/; > > if (exists $ref->{$new}) { > > warn "Padded key $new already exist

Re: joining keys

2003-07-11 Thread Kevin Pfeiffer
In article <[EMAIL PROTECTED]>, John W. Krahn wrote: [...] > Kevin and Rob, > > perldoc -q "add or remove keys from a hash" > > Found in /usr/lib/perl5/5.6.0/pod/perlfaq4.pod >What happens if I add or remove keys from a hash while >iterating over it? > >Don't do that. :

Re: joining keys

2003-07-11 Thread John W. Krahn
Rob Dixon wrote: > > Well done Kevin! > > Just a couple of points. > > Kevin Pfeiffer wrote: > > > > (I noticed that, too.) But thanks to your tip I think I've created > > my first recursive sub-routine (only tested on this example). If it > > does what the OP requested (and y'all don't find too

RE: A thank you gift

2003-07-11 Thread wiggins
On Fri, 11 Jul 2003 15:50:31 -0500, "Michael Weber" <[EMAIL PROTECTED]> wrote: > I have asked many questions of this group and gotten many good answers. > No matter how dumb the question, I have always gotten a kind response. > > Thank you. > >

A thank you gift

2003-07-11 Thread Michael Weber
I have asked many questions of this group and gotten many good answers. No matter how dumb the question, I have always gotten a kind response. Thank you. The fruit of my recent efforts is a program that colorizes text for easier viewing. I needed something that would highlight errors in log fil

Re: Need Regex help !!

2003-07-11 Thread Kevin Pfeiffer
In article <[EMAIL PROTECTED]>, Rob Dixon wrote: > Pandey Rajeev-A19514 wrote: >> >> Rob ANderson wrote: >> > >> > Pandey Rajeev-A19514 wrote: >> > > >> > > In short, I have a defined set of pattern that can occur across any >> > > number of lines(scalars) in a buffer (array of scalars) > and I ne

Re: [OT] - News Sever/reader

2003-07-11 Thread Steve Grazzini
On Fri, Jul 11, 2003 at 03:32:10PM -0500, [EMAIL PROTECTED] wrote: > On Fri, 11 Jul 2003 15:56:31 -0400, "Paul Kraus" <[EMAIL PROTECTED]> wrote: > > are there any good free news servers out there that have access > > to this list? > > Sorry I can't help on the news front, I don't have access eithe

Re: How to invoke the Linux KDE browser?

2003-07-11 Thread wiggins
On Fri, 11 Jul 2003 12:13:19 -0700, "Frank B. Ehrenfried" <[EMAIL PROTECTED]> wrote: > I am going through a chapter in a perl text on cgi - trying to master it. > Appartently, I need to transfer a cgi script to the ISP's server, then invoke > it

RE: [OT] - News Sever/reader

2003-07-11 Thread wiggins
On Fri, 11 Jul 2003 15:56:31 -0400, "Paul Kraus" <[EMAIL PROTECTED]> wrote: > I am getting tired of having 8 mailing lists that are all coming to me > via pop/smtp. Our service provider offers to send news (Seed) to a news > server if we set one up

Re: joining keys

2003-07-11 Thread Kevin Pfeiffer
In article <[EMAIL PROTECTED]>, Rob Dixon wrote: > Well done Kevin! > > Just a couple of points. Am I surprised? ;-) >> sub pad_keys { >>my $ref = shift; >>if (ref $ref eq "HASH") { >> for my $value (%$ref) { > > This will loop over all the keys and values in the > hash, in the o

[OT] - News Sever/reader

2003-07-11 Thread Paul Kraus
I am getting tired of having 8 mailing lists that are all coming to me via pop/smtp. Our service provider offers to send news (Seed) to a news server if we set one up. Should I do this or are there any good free news servers out there that have access to this list? Is outlook a decent windows news

Re: How to end a while(1) loop

2003-07-11 Thread John W. Krahn
Tim Yohn wrote: > > Michael, > > On Fri, 2003-07-11 at 11:56, Michael Weber wrote: > > $line =~ s/reject/$red.reject.$normal/gi ; > > $line =~ s/ from /$yellow from $normal/gi ; > > $line =~ s/status/$blue status $normal/gi ; > > The following does work however I don't kn

Re: -M filetest operator

2003-07-11 Thread Steve Grazzini
On Fri, Jul 11, 2003 at 09:29:28PM +0200, [EMAIL PROTECTED] wrote: > why cant i check the age of a file when the path contains a point? You can. :-) > use File::Basename; > #$path="/home/raid/golchert/.cxoffice/dotwine/filelist.dat"; > $path="/tmp/someFile"; > print "\n alter von $path = ".(-M $p

-M filetest operator

2003-07-11 Thread magelord
hi, why cant i check the age of a file when the path contains a point? --- use File::Basename; #$path="/home/raid/golchert/.cxoffice/dotwine/filelist.dat"; $path="/tmp/someFile"; print "\n alter von $path = ".(-M $path). "\n" if (-M $path <=4 && !(dirname($path)=~/\./) && !(-d $path)); --- maybe

Re: regexpr

2003-07-11 Thread John W. Krahn
Martin Costello wrote: > > Hello, Hello, > I'm trying to do a search and replace on a file (specifically the word > transformC). A cut down version of the file is below: > > blahblah -blah blah > -blah blah -blah $blah -blah "Ground" > -c "blah transformC" transformC; > > blahblah >

RE: Regex parsing question

2003-07-11 Thread Pandey Rajeev-A19514
Hi Rob, Thanks ! That was helpful. Do we have a lex and Yacc equivalent in Perl ? I am writing an automation tool based on Client and server for Cisco devices. I am doing the testcase parsing in Lex and Yacc (flex and bison) to create the parser tree and then I user the server written in Perl t

RE: joining keys

2003-07-11 Thread Gupta, Sharad
Aha! Thanx to all for help. I did'nt realized i can do it like this yesterday. So i created a small routine and passed the keys through it at the time of creation itself. I'll try it. Thanx, -Sharad -Original Message- From: Rob Dixon [mailto:[EMAIL PROTECTED] Sent: Friday, July 11, 200

regexpr

2003-07-11 Thread Martin Costello
Hello, I'm trying to do a search and replace on a file (specifically the word transformC). A cut down version of the file is below: blahblah -blah blah -blah blah -blah $blah -blah "Ground" -c "blah transformC" transformC;

RE: Perl and Exchange Server

2003-07-11 Thread Chris Rogers
Thanks for the answer but I am actually looking for the Contacts folder in a mailbox. The GAL is available easily using LDAP, CDO, or the admin.exe from the command line. -Original Message- From: Barry C. Hawkins [mailto:[EMAIL PROTECTED] Sent: Friday, July 11, 2003 12:27 PM To: Chris R

RE: Perl and Exchange Server

2003-07-11 Thread Chris Rogers
Here is the last feeble attempt: #!\perl\bin\perl.exe -w use strict; use Win32::OLE; use Win32::OLE::Const; my $DEBUG_FLAG = 1; # set it to zero for real job #names have been changed to protect the innocent my $server = "servername"; my $fname = "Firstname"; my $lname = "Lastname"; my $alia

Re: joining keys

2003-07-11 Thread Rob Dixon
Well done Kevin! Just a couple of points. Kevin Pfeiffer wrote: > In article <[EMAIL PROTECTED]>, John W. Krahn wrote: > > > Sharad Gupta wrote: > > > > > > Hi Friends, > > > > Hello, > > Hi, > > > > I have a hash whose values can be either array, hash etc. > > > > > > say i have: > > > > > > my

Re: Regex parsing question

2003-07-11 Thread Rob Dixon
Rob Dixon wrote: > Perl wrote: > > I am attempting to parse a log file that looks something like: > > > > 759033281 TE18 constructor - add to MDBTable > > EX:/O=MSGENG/OU=EUROPE/CN=RECIPIENTS/CN=PHARWOOD > > 759033281 TE18 AddRef=2 > > EX:/O=MSGENG/OU=EUROPE/CN=RECIPIENTS/CN=PHARWOOD > > 75903328

Re: Regex parsing question

2003-07-11 Thread Rob Dixon
Perl wrote: > I am attempting to parse a log file that looks something like: > > 759033281 TE18 constructor - add to MDBTable > EX:/O=MSGENG/OU=EUROPE/CN=RECIPIENTS/CN=PHARWOOD > 759033281 TE18 AddRef=2 > EX:/O=MSGENG/OU=EUROPE/CN=RECIPIENTS/CN=PHARWOOD > 759033281 TE18 S-REXCH-MSG-07 > 75903328

Re: joining keys

2003-07-11 Thread Kevin Pfeiffer
In article <[EMAIL PROTECTED]>, John W. Krahn wrote: > Sharad Gupta wrote: >> >> Hi Friends, > > Hello, Hi, >> I have a hash whose values can be either array, hash etc. >> >> say i have: >> >> my $self = { >> 'hello how' => { >> 'r u' => 'I am', >> >> >

Re: Regex parsing question

2003-07-11 Thread Rob Dixon
Perl wrote: > I am attempting to parse a log file that looks something like: > > 759033281 TE18 constructor - add to MDBTable > EX:/O=MSGENG/OU=EUROPE/CN=RECIPIENTS/CN=PHARWOOD > 759033281 TE18 AddRef=2 > EX:/O=MSGENG/OU=EUROPE/CN=RECIPIENTS/CN=PHARWOOD > 759033281 TE18 S-REXCH-MSG-07 > 75903328

Re: Perl and Exchange Server

2003-07-11 Thread Barry C . Hawkins
On Friday, Jul 11, 2003, at 11:24 US/Eastern, Chris Rogers wrote: I have been trying for some time to get at the contacts in a mailbox on exchange server 5.5. I have been using Win32::OLE with CDO. I can get the contacts folder, the count of items in it, and even the name of each contact but I

Re: How to end a while(1) loop

2003-07-11 Thread Tim Yohn
Michael, On Fri, 2003-07-11 at 11:56, Michael Weber wrote: > $line =~ s/reject/$red.reject.$normal/gi ; > $line =~ s/ from /$yellow from $normal/gi ; > $line =~ s/status/$blue status $normal/gi ; The following does work however I don't know exactly how valid it is (which i

Re: Need Regex help !!

2003-07-11 Thread Rob Dixon
Pandey Rajeev-A19514 wrote: > > Rob ANderson wrote: > > > > Pandey Rajeev-A19514 wrote: > > > > > > In short, I have a defined set of pattern that can occur across any number of > > > lines(scalars) in a buffer (array of scalars) and I need to print only those lines(Scalars) that contain the full

Re: Substituting a space with a comma

2003-07-11 Thread deb
Thanks! I "get it" now! deb At 21:37:06, on 07.10.03: Cracks in my tinfoil beanie allowed Rob Dixon to seep these bits into my brain:, > Deb wrote: > > Rob, you were very helpful in showing me how the split and join > > work, but > > since I wasn't looking to change anything in $line except to >

Re: How to end a while(1) loop

2003-07-11 Thread Michael Weber
First, thanx to Tim and Bob. It is working as I would like. Now I have a substitution question. If $line is "delay=12, status=sent (fw-3.alliednational.com)" how do I make a substitution like this... #!/usr/bin/perl -w use strict; my $line; my $red="\033[0;31m"; my $yellow="\033[0;33m"; my $b

RE: Perl and Exchange Server

2003-07-11 Thread Tim Johnson
Maybe it would help if you gave us what you've tried? -Original Message- From: Chris Rogers [mailto:[EMAIL PROTECTED] Sent: Friday, July 11, 2003 8:24 AM To: [EMAIL PROTECTED] Org (E-mail) Subject: Perl and Exchange Server I have been trying for some time to get at the contacts in a mai

Perl and Exchange Server

2003-07-11 Thread Chris Rogers
I have been trying for some time to get at the contacts in a mailbox on exchange server 5.5. I have been using Win32::OLE with CDO. I can get the contacts folder, the count of items in it, and even the name of each contact but I can't seem to get at any of the fields. I have found many examples

help needed plzz...

2003-07-11 Thread vemulakonda uday bhaskar
hi all i have got a code for transferring files from one linux system to another linux system through SFTP. i have installed in both systems Net::SFTP; my code is as follows: #!usr/bin/perl use Net::SFTP; use strict; use warnings; my $sftp=Net::SFTP->new("xxx.xxx.xxx.xxx",user=>"aaa",passwo

RE: How to end a while(1) loop

2003-07-11 Thread Bob Showalter
Michael Weber wrote: > I am trying to write a simple filter that will mark in different > colors certain words as they pass through. > > For example, if I do a tail -f /var/log/messages I want words I am > looking for to be in red and other words in yellow with the rest of > the text unchanged. (

Re: Creating a hash of arrays from row data

2003-07-11 Thread Sudarshan Raghavan
Robin Norwood wrote: To sort-of change the subject, I think the 'deep_copy' subroutine quoted in this article contains a bug... the sub in question: sub deep_copy { my $this = shift; if (not ref $this) { $this; } elsif (ref $this eq "ARRAY") { [map deep_copy($_), @$this]; } elsif (ref $t

Re: delete file

2003-07-11 Thread Asif Iqbal
try unlink . example: unlink $file; On Fri, 11 Jul 2003, Boon Chong Ang wrote: > Hi, > > My name is Boon Chong. I have question. Just say, I run a perl script > and in between of the process I create a temporarily file for checking > purpose. Now, how do I ask perl to delete the file automatically

[OT] Re: Why is $_ being change.

2003-07-11 Thread Elias Assmann
On Thu, Jul 10, 2003 at 08:39:05PM -0700, [EMAIL PROTECTED] wrote: > > Geez, is that your real name? Yes, it is. However, where I live, few people find it remarkable. If I ever felt bad about it, maybe laughing a bit about Johnny Depp's name would cheer me up ("Depp" means "idiot" in German

RE: Need Regex help !!

2003-07-11 Thread Pandey Rajeev-A19514
Hi Rob, Yes, I need a tight pattern representation because the buffer I need to parse is slightly complicated than what I had pasted in the mail. /(FastEthernet|down)/i) gives me an option of "FastEthernet" OR "down". I want something like "FastEthernet" AND "down". How do we give AND operatio

Re: Hiding Params in url

2003-07-11 Thread Dennis Stout
POST versus GET. POST won't pass the value in the url. This doesn't prevent someone from doing a view source and reading the text, but A crypt() on the parameters would be a good idea, then pass the encrypted string around. S.T.O.U.T. = Synthetic Technician Optimized for Ultimate Troublsho

Re: Need Regex help !!

2003-07-11 Thread Rob Anderson
Hi Rajeev, I'm not sure why you feel the need to join your buffer into a big string. >From what you describe couldn't you just process each buffer element one by one? foreach my $buffer_entry (@buff) { if($buffer_entry =~ /(FastEthernet|down)/i) { print $buffer_entry; } } Let us

Need Regex help !!

2003-07-11 Thread Pandey Rajeev-A19514
Hi, In short, I have a defined set of pattern that can occur across any number of lines(scalars) in a buffer (array of scalars) and I need to print only those lines(Scalars) that contain the full or partial pattern. For eg. For the buffer @buff (as shown below), I have to find out the occurance

Re: delete file

2003-07-11 Thread John W. Krahn
Boon Chong Ang wrote: > > Hi, Hello, > My name is Boon Chong. I have question. Just say, I run a perl script > and in between of the process I create a temporarily file for checking > purpose. Now, how do I ask perl to delete the file automatically? Use IO::File::new_tmpfile() perldoc IO::Fil

How to get a file

2003-07-11 Thread vemulakonda uday bhaskar
hi all my code : #!usr/local/bin use Net::SFTP; use Net::SSH::Perl; use strict; use warnings; my $SFTP=Net::SSH::Perl->new("xxx.xxx.xxx.xxx") or die "Cant connect"; $sftp->login("xyz","abc"); the above code is working fine. Bu what is tehe command to get or put a file the command $sftp->get("

Re: a program problem for print?

2003-07-11 Thread John W. Krahn
Julie Xu wrote: > > Greeting, Hello, > I am trying to create a simple perl script to read a text file (8 columns > separated by space) and output the colume6,8. > > The file format is: > Entry11 entry12 entry13 entry14 entry15 entry16 entry17 entry18 > Entry21 entry22 entry23 entry24 entry25 en

Re: delete file

2003-07-11 Thread Sudarshan Raghavan
Boon Chong Ang wrote: Hi, My name is Boon Chong. I have question. Just say, I run a perl script and in between of the process I create a temporarily file for checking purpose. Now, how do I ask perl to delete the file automatically? Automatically as in, when the script finished executing? Use t

RE: delete file

2003-07-11 Thread NYIMI Jose (BMB)
perl -f unlink http://www.perldoc.com/perl5.8.0/pod/func/unlink.html José. > -Original Message- > From: Boon Chong Ang [mailto:[EMAIL PROTECTED] > Sent: Friday, July 11, 2003 10:13 AM > To: [EMAIL PROTECTED] > Subject: delete file > > > Hi, > > My name is Boon Chong. I have question.

delete file

2003-07-11 Thread Boon Chong Ang
Hi, My name is Boon Chong. I have question. Just say, I run a perl script and in between of the process I create a temporarily file for checking purpose. Now, how do I ask perl to delete the file automatically? Thank you & best regards, ABC