Re: truth test on a hash

2003-03-06 Thread Sudarshan Raghavan
On 5 Mar 2003, jdavis wrote: > hello, > I am trying to test a key from a hash in a hash > the script gives me the desired result overall but i get > the warning ... > Use of uninitalized value in pattern match (m//) at ./passwd.pl line 26. > could someone tell me why i get this error > > here is

Getting a whole directory using Net::FTP

2003-03-06 Thread ruben van de vijver
Hi, I would like to upload and download files to a Linux server from my Windows machine. So, I set out to write a little script that does just that. Uploading, it turns out, is no problem. I use an "opendir" statement to open the directory, then readdir to read its contents and then each file

Re: Getting a whole directory using Net::FTP

2003-03-06 Thread Sudarshan Raghavan
On Thu, 6 Mar 2003, ruben van de vijver wrote: > Hi, > > I would like to upload and download files to a Linux server from my > Windows machine. So, I set out to write a little script that does just > that. Uploading, it turns out, is no problem. I use an "opendir" > statement to open the direc

Re: Module listing

2003-03-06 Thread Rob Dixon
Janek Schleicher wrote: > Rob Dixon wrote at Wed, 05 Mar 2003 18:28:36 +: > > > Rob wrote: > > > Is there a perl command to list installed modules? > > > > This is a FAQ. > > Where can this FAQ be found ? > I tried > perldoc -q installed > perldoc -q module > perldoc -q list > with Perl 5.8.0

Re: looking for a better way, a perl way

2003-03-06 Thread Rob Dixon
Hi Jerry. "Jerry Preston" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi! > > I am looking for way to reduce the following code, a better way, a perl > way. Any ideas? I think you've been overlooked a little because your post looks very much like a 'please do my work for me' p

trying to match variable names

2003-03-06 Thread Daniel Mueller
hi group! i'm currently trying to match all variables in a file, the regex i use looks like this : m/([\$|\@|\%]\w+)/g it matches as far as i can see what i want but it also matches stuff like this : |SOMETEXT why is this? what am i doing wrong? thanks in advance daniel. -- To unsubscrib

Re: trying to match variable names

2003-03-06 Thread Pete Emerson
Daniel, Inside [ ] means "any of the following", so you don't use the | as an OR in this situation. Take the | out and you should be fine. Here's my example: #!/usr/bin/perl -w use strict; my $variable1; my @variable2; my %variable3; $variable1=1; @variable2=(1,2,3); %variable3=(1,2,3,4); # |SOME

Re: Module listing

2003-03-06 Thread Janek Schleicher
Rob Dixon wrote at Thu, 06 Mar 2003 11:06:06 +: >> > > Is there a perl command to list installed modules? >> > >> > This is a FAQ. >> >> Where can this FAQ be found ? >> I tried >> perldoc -q installed >> perldoc -q module >> perldoc -q list >> with Perl 5.8.0 > > I was meaning 'This is a Fre

Re: trying to match variable names

2003-03-06 Thread Stefan Lidman
Daniel Mueller wrote: > > hi group! > > i'm currently trying to match all variables in a file, the regex i use looks > like this : > > m/([\$|\@|\%]\w+)/g You seem to have mixed two ways to do it m/([EMAIL PROTECTED])/g; or m/((?:\$|\@|%)\w+)/g; /Stefan -- To unsubscribe, e-mail: [EMAIL

Re: [OT] YAPC::NA 2003 Registration

2003-03-06 Thread Kevin Meltzer
Sorry :) http://yapc.org/America/ Cheers, Kevin On Wed, Mar 05, 2003 at 05:49:52PM -0800, R. Joseph Newton ([EMAIL PROTECTED]) said something similar to: > Kevin Meltzer wrote: > > > Hello folks, > > > > ... > > It will be June 16-18, 2003 in Boca Raton, FL. Please visit the website > > to lea

pattern matching problems

2003-03-06 Thread Francesco del Vecchio
Hi to all, Im new to the list and to the Perl too...and I've some problems with pattern matching. from a string of this kind: that can have none or more parameter (as color) I would like to estract th 'kiwpg' value. How can I do? = another problem If I have a string

Re: pattern matching problems

2003-03-06 Thread Pete Emerson
On Thu, 2003-03-06 at 09:32, Francesco del Vecchio wrote: > If I have a string as the following: > a xx b a x b > and I try a m/a(.*)b/g > $1 = xx b a x > what have I to do to obtain two matches each of one give me > $1 = x #!/usr/bin/perl -w u

Re: pattern matching problems

2003-03-06 Thread Stefan Lidman
#!/usr/bin/perl -w use strict; my $string = q(); my $string2 = 'a xxbxxx b a xxaxx b'; print "$1\n" if $string =~ m!kiwpg=(.*?)'!; #' my @array = $string2 =~ m/a(.*?)b/g; print "@array\n"; __END__ . match one of anything * match what is before it 0 or more

pattern matching problems 2

2003-03-06 Thread Francesco del Vecchio
Here I am again ^_^ thanks a lot for the previous answers...they solved my problem. I have another problem of the same kind...let me explain: = String " bb=somestuff someotherstuff" I don't know what "somestuff" and "someotherstuff" are...I only kn

Re: pattern matching problems 2

2003-03-06 Thread Rob Dixon
Francesco Del Vecchio wrote: > > String " bb=somestuff someotherstuff" > > I don't know what "somestuff" and "someotherstuff" are...I only know > that they are two words separed by a space. > > How can I extract 'somestuff' from the string? Hi Francesco . It depends how you want to define wh

Re: pattern matching problems 2

2003-03-06 Thread Francesco del Vecchio
Maybe I can explain better showing you the real problem. I have an HTML form and I'm parsing it looking for tags When I find one I need to catch the "ACTION" value. i.e. http://www.somedomain.com method=post> I need to catch "http://www.somedomain.com";. Obiouvsly the "method" can also not t

Re: pattern matching problems 2

2003-03-06 Thread Rob Dixon
Francesco Del Vecchio wrote: > Maybe I can explain better showing you the real problem. > > I have an HTML form and I'm parsing it looking for tags > > When I find one I need to catch the "ACTION" value. > > i.e. > > http://www.somedomain.com method=post> > > I need to catch "http://www.somedomain

RE: looking for a better way, a perl way

2003-03-06 Thread Bakken, Luke
Look at the sprintf function. Please! > # while ( $data ) = $sth->fetchrow()) { > $l = length( $Site ); > if( $l != 5 ) { > $s = substr( "", 0, 5 - $l ); > $Site .= $s; > } Does this do what you want? $Site = sprintf '%-5s', $Site; One liner: C:\>perl -e"$S

Re: truth test on a hash

2003-03-06 Thread R. Joseph Newton
jdavis wrote: if($hoh{$who}{$what} =~ /\w/){ > print "$hoh{$who}{$what}\n"; hoh? Huh?!? Where'dthatcomefrom? use strict; Joseph -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Commands inside a reg-ex substitution problems

2003-03-06 Thread Jensen Kenneth B SrA AFPC/DPDMPQ
Trying to get this to work on one line, but not having any success. In my boredom I re-wrote the find command using perl4, and in tweaking it I'm running into a problem. When I type in a starting search path as "./something/something" I want to replace the "." with the current working directory. S

Re: looking for a better way, a perl way

2003-03-06 Thread John W. Krahn
Jerry Preston wrote: > > Hi! Hello, > I am looking for way to reduce the following code, a better way, a perl > way. Any ideas? > > while ( my ( $Site, $Description, $Part_Number, $Part_Serial_Number, $Qty, > $RMA_Number, $Customer_Contac, $RMA_Date, $Part_Rec ) = $sth->fetchrow()) { > # w

Re: trying to match variable names

2003-03-06 Thread John W. Krahn
Daniel Mueller wrote: > > hi group! Hello, > i'm currently trying to match all variables in a file, the regex i use looks > like this : > > m/([\$|\@|\%]\w+)/g > > it matches as far as i can see what i want but it also matches stuff like > this : > > |SOMETEXT > > why is this? what am i doin

Re: Commands inside a reg-ex substitution problems

2003-03-06 Thread John W. Krahn
Jensen Kenneth B Sra Afpc/Dpdmpq wrote: > > Trying to get this to work on one line, but not having any success. In my > boredom I re-wrote the find command using perl4, and in tweaking it I'm > running into a problem. When I type in a starting search path as > "./something/something" I want to re

Re: Commands inside a reg-ex substitution problems

2003-03-06 Thread Scott R. Godin
John W. Krahn wrote: >> ($_pattern, $_start) = (shift, shift); >> print "Starting search at: $_start\n"; >> >> chdir "$_start"; > > Useless use of quotes. You should verify that chdir worked. > > unless ( chdir $_start ) { > print STDERR "Cannot chdir to $_start: $!"; > exit 1; > }

Help! What am I doing wrong?

2003-03-06 Thread meriwether lewis
Hi Experts! Hoping someone can help me out. Here goes... bear with me, please. I have a file that contains a few email addresses. I read this file and push each line into an array: push(@AddrArray, $_); Then I do a foreach on the contents of the array: foreach $AddrToCheck (@AddrArray) { .

RE: trying to match variable names

2003-03-06 Thread Carrara, Greg
Hello, I'm trying to write a script that reads a file line by line and if the line contains a space it puts quotation marks around it and writes it to another file. I mostly have this working except that in the case of the lines that contain the space it puts the quotation mark at the beginning of

Handling race conditions

2003-03-06 Thread Michael Weber
Greetings, all! I have a mail server with swatch examining the log files looking for root.exe, /winnt/system32, etc. The idea is finding anyone who is scanning for root kits on my mail server gets blocked at the mail server and the firewall with an iptables command. What I have is swatch executi

Someone DO explain this to me!

2003-03-06 Thread Jeff Westman
In other languages, such as C, there is little difference between a while() loop and a do-while() loop. The only difference of course being that that do-while() loop will always execute at least once (test after), while the while-loop does a test before Much to my amazement, do() in perl is

RE: trying to match variable names

2003-03-06 Thread Bakken, Luke
> Hello, > I'm trying to write a script that reads a file line by line > and if the line > contains a space it puts quotation marks around it and writes > it to another > file. I mostly have this working except that in the case of > the lines that > contain the space it puts the quotation mark

RE: Help! What am I doing wrong?

2003-03-06 Thread Mark Anderson
[most of message cut for clarity, see original for context] > Now, I have an internally developed function > (the internal of which are hidden from me) which > processes the email addresses. This takes as one > of it's parameters an array of strings. > So before I call the function I say: > @AddrL

HTML for my perl CGI

2003-03-06 Thread Luinrandir Hernsen
Can anyone direct me to HTML help? Re: Tables, backround, and images Thanks Lou -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: trying to match variable names

2003-03-06 Thread Pete Emerson
The EOLN character is not being stripped out, so you're getting it before your quote. chomp it to remove it. Here's my version: #!/usr/bin/perl -w use strict; open INFILE, "accounts.txt" or die "Can't open INFILE: $!"; open OUTFILE, ">nospace.txt" or die "Can't open OUTFILE: $!"; while () {

test

2003-03-06 Thread Thomas Browner
test

Re: Commands inside a reg-ex substitution problems

2003-03-06 Thread Jenda Krynicky
From: "Scott R. Godin" <[EMAIL PROTECTED]> > John W. Krahn wrote: > > unless ( opendir( DIR, $_start ) ) { > > print STDERR "Cannot open $_start: $!"; > > exit 1; > > } > > die "Cannot open directory $_start: $!" > unless opendir(DIR, $_start); Just FYI these two are not equiv

RE: Handling race conditions

2003-03-06 Thread Bakken, Luke
It sounds like you need two things: 1. A faster way of storing "seen" IPs. 2. A lock mechanism to keep perl processes queued up waiting to write new iptables entries. Having the perl script write a lock file as it is updating the iptables should be easy - subsequent scripts can wait to ensure tha

RE: trying to match variable names

2003-03-06 Thread Mark Anderson
You probably should have started a new thread for this discussion. > I'm trying to write a script that reads a file line by line and if the line > contains a space it puts quotation marks around it and writes it to another > file. I mostly have this working except that in the case of the lines th

RE: Someone DO explain this to me!

2003-03-06 Thread Hanson, Rob
> Much to my amazement, do() in perl is > a STATEMENT BLOCK and not a loop! But that doesn't mean that you can't use it like one. In Perl you can use for/while/if/unless after a statement... print "Blue" if $x == 1; print ++$x while $x < 10; The "do" lets you turn the for into a do-for, if into

Re: Help! What am I doing wrong?

2003-03-06 Thread Wiggins d'Anconia
Mark Anderson wrote: [most of message cut for clarity, see original for context] Now, I have an internally developed function (the internal of which are hidden from me) which processes the email addresses. This takes as one of it's parameters an array of strings. So before I call the function I

RE: trying to match variable names

2003-03-06 Thread Mark Anderson
> > I'm trying to write a script that reads a file line by line and if the line > > contains a space it puts quotation marks around it and writes it to another > > file. I mostly have this working except that in the case of the lines that > > contain the space it puts the quotation mark at the

RE: Commands inside a reg-ex substitution problems

2003-03-06 Thread Jensen Kenneth B SrA AFPC/DPDMPQ
>Jensen Kenneth B Sra Afpc/Dpdmpq wrote: >> >> Trying to get this to work on one line, but not having any success. In >> my boredom I re-wrote the find command using perl4, and in tweaking it >> I'm running into a problem. When I type in a starting search path as >> "./something/something"

Re: Someone DO explain this to me!

2003-03-06 Thread Jenda Krynicky
From: Jeff Westman <[EMAIL PROTECTED]> > In other languages, such as C, there is little difference between a > while() loop and a do-while() loop. The only difference of course > being that that do-while() loop will always execute at least once > (test after), while the while-loop does a test bef

whois

2003-03-06 Thread Thomas Browner
Can some tell me what is a good whois mod for perl that works with activestate? Thomas Browner Digidyne, Inc Technical Engineer (251)479-1637

RE: trying to match variable names

2003-03-06 Thread Bakken, Luke
> > > line. My guess is that > > > print OUTFILE ($line); > > > also feeds a CR. Is there a way around this? > > > while () { > > chomp; > > if (/ /) { > > print OUTFILE "\"$line\"\n"; > > } > > else { > > print OUTFILE $line, "\n"; > > } > > } > > >

Re: Help! What am I doing wrong?

2003-03-06 Thread Wiggins d'Anconia
See mark's reply also but there is a chance it is something else meriwether lewis wrote: Hi Experts! This takes as one of it's parameters an array of strings. An array of strings, or an array reference? big difference. I then pass @AddrList to the function like so: processAddrList($foo, "N

RE: Script does not want to run, error

2003-03-06 Thread LoBue, Mark
> -Original Message- > From: mel awaisi [mailto:[EMAIL PROTECTED] > Sent: Wednesday, March 05, 2003 2:11 PM > To: [EMAIL PROTECTED] > Subject: Script does not want to run, error > > > Hi, > > I am having problems opening this script on my machine. i > have been getting > help from a ve

Re: Handling race conditions

2003-03-06 Thread Wiggins d'Anconia
Michael Weber wrote: Greetings, all! I have a mail server with swatch examining the log files looking for root.exe, /winnt/system32, etc. The idea is finding anyone who is scanning for root kits on my mail server gets blocked at the mail server and the firewall with an iptables command. What I

Re: pattern matching problems 2

2003-03-06 Thread R. Joseph Newton
Francesco del Vecchio wrote: > Maybe I can explain better showing you the real problem. > > I have an HTML form and I'm parsing it looking for tags > > When I find one I need to catch the "ACTION" value. > > i.e. > > http://www.somedomain.com method=post> > > I need to catch "http://www.somedomai

Re: HTML for my perl CGI

2003-03-06 Thread Wiggins d'Anconia
Luinrandir Hernsen wrote: Can anyone direct me to HTML help? Re: Tables, backround, and images Thanks Lou You mean besides the obvious: http://www.google.com/search?&q=HTML Remember this is a Perl list. There must be as many books on HTML as there are web pages at this point, check any bookst

Re: Commands inside a reg-ex substitution problems

2003-03-06 Thread Wiggins d'Anconia
Jensen Kenneth B SrA AFPC/DPDMPQ wrote: The use of quotes may be useless, but it's just more aesthetically appealing to me. I doubt they really effect processing speed by any measurable amount anyway :). As just posted, the quotes affect more than speed... perldoc -q "wrong with always quotin

Re: Someone DO explain this to me!

2003-03-06 Thread Jeff Westman
Jenda, You CANNOT do what you are suggesting. $ perldoc -f do do BLOCK Not really a function. Returns the value of the last command in the sequence of commands indicated by BLOCK. When modified by a loop modifier, executes the BLOCK once before

RE: Someone DO explain this to me!

2003-03-06 Thread Jeff Westman
--- "Hanson, Rob" <[EMAIL PROTECTED]> wrote: > > Much to my amazement, do() in perl is > > a STATEMENT BLOCK and not a loop! > > But that doesn't mean that you can't use it like one. > > In Perl you can use for/while/if/unless after a statement... > > print "Blue" if $x == 1; > print ++$x while

RE: Someone DO explain this to me!

2003-03-06 Thread Jeff Westman
According to the perl documentation because 'do' is a STATEMENT, you cannot use LOOP CONSTRUCTS (next, last). Sure, you can loop (as shown below), but you cannot exit the loop with "last". (I should have been more clear in my original post) Consider the following: $ nl -ba x 1 #!/usr

RE: Handling race conditions

2003-03-06 Thread LoBue, Mark
> -Original Message- > From: Bakken, Luke [mailto:[EMAIL PROTECTED] > Sent: Thursday, March 06, 2003 4:47 PM > To: Michael Weber; [EMAIL PROTECTED] > Subject: RE: Handling race conditions > > > It sounds like you need two things: > > 1. A faster way of storing "seen" IPs. > 2. A lock mec

RE: trying to match variable names

2003-03-06 Thread david
Greg Carrara wrote: > > unless (open(INFILE, "accounts.txt")) { > > die ("Cannot open input file accounts.txt.\n"); > } > > unless (open(OUTFILE, ">nospace.txt")) { > > die ("Cannot open output file nospace.txt.\n"); > } > > $line = ; > > while ($line ne "") { > > if ($line

RE: Handling race conditions

2003-03-06 Thread david
Mark Lobue wrote: > > Check out "Network Programming with Perl". It can show you how to set up > an easy client-server system, where your mail server can call the client, > and > the client contacts the server through a socket. Even if many clients > fire at once, the socket connection forces s

Re: Handling race conditions

2003-03-06 Thread R. Joseph Newton
Wiggins d'Anconia wrote: > > In general this would be handled with a lock file. When the first > instance of your script starts it would check for the lock file if it > exists then just exit, if it doesn't then it opens a file (.lock for > example) then does its processing, and then removes the lo

Weird POP3Client Problem.

2003-03-06 Thread Gregg R . Allen
I have been using: use Mail::POP3Client; $pop = new Mail::POP3Client( USER => "TheUser", PASSWORD => "MyPassword", HOST => "Mail.Host.com"); successfully for some time to read and parse email off a remote server. I was aske

Re: Commands inside a reg-ex substitution problems

2003-03-06 Thread John W. Krahn
"Scott R. Godin" wrote: > > John W. Krahn wrote: > > >> ($_pattern, $_start) = (shift, shift); > >> print "Starting search at: $_start\n"; > >> > >> chdir "$_start"; > > > > Useless use of quotes. You should verify that chdir worked. > > > > unless ( chdir $_start ) { > > print STDERR "Canno

Re: Commands inside a reg-ex substitution problems

2003-03-06 Thread John W. Krahn
Jensen Kenneth B Sra Afpc/Dpdmpq wrote: > > > >$_spath =~ s{^\.} > >{ $path = `pwd`; > > chop $path; > > $path > >}e; > > I wasn't aware I could have multiple commands in there. Had to change it > around so perl4 would be happy, no white space and

RE: Someone DO explain this to me!

2003-03-06 Thread Jeff Westman
You can loop, but can NOT use loop constructs, such as next or last. --- "Hanson, Rob" <[EMAIL PROTECTED]> wrote: > > Much to my amazement, do() in perl is > > a STATEMENT BLOCK and not a loop! > > But that doesn't mean that you can't use it like one. > > In Perl you can use for/while/if/unless

Re: trying to match variable names

2003-03-06 Thread John W. Krahn
Greg Carrara wrote: > > Hello, Hello, > I'm trying to write a script that reads a file line by line and if the line > contains a space it puts quotation marks around it and writes it to another > file. I mostly have this working except that in the case of the lines that > contain the space it p

PErl subroutine

2003-03-06 Thread Johnstone, Colin
Gidday All, please help with my subroutine sub cleanText{ my $cleanedText = @_; $cleanedText =~ s{}{}g; $cleanedText =~ s{}{}g; $cleanedText =~ s{<\/b>}{<\/span>}g; $cleanedText =~ s{Fittingly, the first student to arrive on the first day at Booligal Public's new era was Steven Spiers.

Re: PErl subroutine

2003-03-06 Thread Sudarshan Raghavan
On Fri, 7 Mar 2003, Johnstone, Colin wrote: > Gidday All, > > please help with my subroutine > > sub cleanText{ > my $cleanedText = @_; This is the problem, assigning an array to a scalar stores the number of elements in the array (in this case the number of args to cleanText) in the scalar

RE: PErl subroutine

2003-03-06 Thread Toby Stuart
> -Original Message- > From: Johnstone, Colin [mailto:[EMAIL PROTECTED] > Sent: Friday, March 07, 2003 4:11 PM > To: [EMAIL PROTECTED] > Subject: PErl subroutine > > > Gidday All, > > please help with my subroutine > > sub cleanText{ > my $cleanedText = @_; > my $cleanedText = s

Re: PErl subroutine

2003-03-06 Thread R. Joseph Newton
"Johnstone, Colin" wrote: > Gidday All, > > please help with my subroutine > Your call to this sub below offers a single string parameter--which happens to be multiline. > > sub cleanText{ > my $cleanedText = @_; #Since there is one element in @_, $cleanedText now has the value 1 or '1' > $

Re: PErl subroutine

2003-03-06 Thread Janek Schleicher
Sudarshan Raghavan wrote at Fri, 07 Mar 2003 10:53:31 +0530: >> sub cleanText{ >> my $cleanedText = @_; > > This is the problem, assigning an array to a scalar stores the number of > elements in the array (in this case the number of args to cleanText) in > the scalar ($cleanedText). Change this

Re: Handling race conditions

2003-03-06 Thread simran
On Fri, 2003-03-07 at 13:51, R. Joseph Newton wrote: > Wiggins d'Anconia wrote: > > > > > In general this would be handled with a lock file. When the first > > instance of your script starts it would check for the lock file if it > > exists then just exit, if it doesn't then it opens a file (.lock