problem with readline

2007-06-23 Thread Mathew Snyder
I have a script that queries a database, grabs a bunch of email addresses from it and generates a procmail ruleset for each of them. It also opens a file which contains additional email address and reads them into an array: open AUTHFILE, "connect("dbi:Pg:dbname=xx;host=10.0.2.30", "x", "

Re: nevermind

2007-06-23 Thread Mathew Snyder
You'll notice in the section that creates the filehandle I have a statement that says "next if $address =~ m/^#/gmx;". I had to escape the "#". Can anyone tell me why that is? It isn't a special character for regexes that I've ever seen used. Thanks, Mathew -- Keep up with me and what I'm up

Re: writing to file

2007-06-23 Thread Yogesh Sawant
Vahid wrote: > Hi all, > I have the following code to sort UNIX's password file, it works fine > but can only display on stdout. How can I make it write the output to > a file? > Thanks, > > #!/bin/perl -w > # > use strict; > open(myFILE, '|-','awk','-F:','s[$1]++==0' ) or die $!; > open(passwdFH,

strange unexpected deadlock

2007-06-23 Thread Michael Scondo
Hi, I'm trying to make myself familiar with threads. However, I encountered some unexpected behaviour of locks/cond_wait I wasn't able to figure out. Could someone explain to me what's happening ?? Thanks, Michael -- #!/usr/bin/perl -w use threads; use threads::shared; sh

Re: nevermind

2007-06-23 Thread Paul Lalli
On Jun 23, 4:18 am, [EMAIL PROTECTED] (Mathew Snyder) wrote: > You'll notice in the section that creates the filehandle I have a statement > that > says "next if $address =~ m/^#/gmx;". I had to escape the "#". Can anyone > tell > me why that is? It isn't a special character for regexes that I

Re: nevermind

2007-06-23 Thread Dr.Ruud
Mathew Snyder schreef: > You'll notice in the section that creates the filehandle I have a > statement that says "next if $address =~ m/^#/gmx;". I had to escape > the "#". Can anyone tell me why that is? It isn't a special > character for regexes that I've ever seen used. Check out what the x

Re: nevermind

2007-06-23 Thread Mumia W.
On 06/23/2007 04:30 AM, Mumia W. wrote: [...] You also could have written it this way: open AUTHFILE, "; chomp @email_list; close AUTHFILE; :-) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: nevermind

2007-06-23 Thread Mumia W.
On 06/23/2007 03:18 AM, Mathew Snyder wrote: You'll notice in the section that creates the filehandle I have a statement that says "next if $address =~ m/^#/gmx;". I had to escape the "#". Can anyone tell me why that is? It isn't a special character for regexes that I've ever seen used. Tha

Re: problem with readline

2007-06-23 Thread Tom Phoenix
On 6/23/07, Mathew Snyder <[EMAIL PROTECTED]> wrote: foreach my $address (readline AUTHFILE){ chomp($address); next if $address =~ m/^#/gmx; The author of that code probably doesn't know what /g, /m, and /x do for a pattern match. When you know how to use them, they're powerful tools.

Re: problem with readline

2007-06-23 Thread Mathew
Tom Phoenix wrote: > On 6/23/07, Mathew Snyder <[EMAIL PROTECTED]> wrote: > >> foreach my $address (readline AUTHFILE){ >> chomp($address); >> next if $address =~ m/^#/gmx; > > The author of that code probably doesn't know what /g, /m, and /x do > for a pattern match. When you know how to

Re: nevermind

2007-06-23 Thread Mathew
Actually, I didn't write the code. It was written by someone else whom no longer works at our company. Keep up with my goings on at http://theillien.blogspot.com Paul Lalli wrote: > On Jun 23, 4:18 am, [EMAIL PROTECTED] (Mathew Snyder) wrote: >> You'll notice in the section that creates the file

Re: strange unexpected deadlock

2007-06-23 Thread Tom Phoenix
On 6/23/07, Michael Scondo <[EMAIL PROTECTED]> wrote: sub thread1{ print "1\n"; lock $x; print "locked x: 1\n"; cond_wait $x; Can't get past here until $x is signalled by another thread, and unlocked by all other threads.

Compile perl into binary code for speed increase?

2007-06-23 Thread howa
Hello, Are there any method to compile the perl script for performance increase, sth similar to mod_perl? but my script is run from command line... thanks. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

setting a hidden field with WWW::Mechanize

2007-06-23 Thread skywriter14
Hello, I have been trying to set some hidden form fields with WWW::Mechanize, but I get error that they are read only. Is it a cannot-be-done case for all hidden input form fields? Does anyone has some tips for me? These fields are some times hidden, sometimes visible textfields. Right now I am g

Re: Compile perl into binary code for speed increase?

2007-06-23 Thread Chas Owens
On 6/23/07, howa <[EMAIL PROTECTED]> wrote: Hello, Are there any method to compile the perl script for performance increase, sth similar to mod_perl? but my script is run from command line... thanks. Only in startup costs (and over the course of a long running program these are minimal). Ta

Re: setting a hidden field with WWW::Mechanize

2007-06-23 Thread Tom Phoenix
On 6/23/07, skywriter14 <[EMAIL PROTECTED]> wrote: I have been trying to set some hidden form fields with WWW::Mechanize, but I get error that they are read only. Have you seen this entry in the FAQ? Why do I get "Input 'fieldname' is readonly"? You're trying to change the value of a h

Re: quoted-printable characters

2007-06-23 Thread Dr.Ruud
Tom Allison schreef: > MIME::QuotedPrintable seems to only do conversions to ASCII which > screws up the conversion. ITYM MIME::QuotedPrint. See also MIME::Decode (and relatives). -- Affijn, Ruud "Gewoon is een tijger." -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e

Re: Compile perl into binary code for speed increase?

2007-06-23 Thread Tom Phoenix
On 6/23/07, howa <[EMAIL PROTECTED]> wrote: Are there any method to compile the perl script for performance increase, Certainly, dozens. Fortunately for everyone involved, all of these methods are applied automatically every time you run your program, so every Perl program always runs at top s

Re: quoted-printable characters

2007-06-23 Thread Tom Allison
This is where I got into trouble. MIME::Parser I can't seem to find any way to parse EVERYTHING to Unicode. there's mention of it, and mention that you don't want to do that. But I'm not sure why unless it's considered CPU intensive. On Jun 23, 2007, at 1:54 PM, Dr.Ruud wrote: Tom Allison schre

Re: setting a hidden field with WWW::Mechanize

2007-06-23 Thread skywriter14
Hi Tom, Thanks for your reply. (I am a big fan) In fact I did read that FAQ. But missed the point actually. I made up in my mind that warnings should be cured at all times, not ignored/ suppressed. But it makes sense turning off warning for that block. And it solves my problem. I was thinking o

grep from one file and write to another

2007-06-23 Thread Vahid Moghaddasi
Hi all, I am trying to read a colon delimited text file (filter.in) then search for each field in another file (/etc/passwd) and if it is found then write that line in the third file (passwd.out). Here is what I have written so far but it is not given me the correct result. Thanks for any help.

Conditional in regex

2007-06-23 Thread Jeff
Hi all. I'm new to perl, a new programmer, and I badly need guidance. I'm trying to parse a config file with key/value pairs seperated by white space and surrounded by curly brackets. It has multiple fields that look like this: { Key value Key value } My solution has been to parse it with som

Re: grep from one file and write to another

2007-06-23 Thread Tom Phoenix
On 6/23/07, Vahid Moghaddasi <[EMAIL PROTECTED]> wrote: I am trying to read a colon delimited text file (filter.in) then search for each field in another file (/etc/passwd) and if it is found then write that line in the third file (passwd.out). use File::Copy; Are you actually using File::C

Re: Conditional in regex

2007-06-23 Thread Tom Phoenix
On 6/23/07, Jeff <[EMAIL PROTECTED]> wrote: trying to parse a config file with key/value pairs seperated by white space and surrounded by curly brackets. It has multiple fields that look like this: { Key value Key value } I'll bet it would be easy to parse with Parse::RecDescent. http

Re: grep from one file and write to another

2007-06-23 Thread Vahid Moghaddasi
On 6/23/07, Tom Phoenix <[EMAIL PROTECTED]> wrote: > use File::Copy; Are you actually using File::Copy? I didn't find any call to it in your posted code. Sorry, I left it in by mistake. This code is a small part of a very large program. > use strict; > use warnings; That's good > $|=1

Re: grep from one file and write to another

2007-06-23 Thread Tom Phoenix
On 6/23/07, Vahid Moghaddasi <[EMAIL PROTECTED]> wrote: For each field (user) in the filter.in file, I will have to find the user in passwd file, wouldn't I need to re-read the passwd file as much as there are fields in filter.in file? Probably not. For one solution, you might be able to use g

Re: grep from one file and write to another

2007-06-23 Thread John W. Krahn
Vahid Moghaddasi wrote: Hi all, Hello, I am trying to read a colon delimited text file (filter.in) then search for each field in another file (/etc/passwd) and if it is found then write that line in the third file (passwd.out). Here is what I have written so far but it is not given me the cor