Can IPC work?

2002-07-22 Thread Mayank Ahuja
Hi All, Please go through the following scenario: A perl script has been invoked from shell A. Within the perl script, I open a new terminal (say B) allowing the user set a particular variable to his choice. The user sets the variable in this terminal and will exit the terminal so that the perl

Re: sorting %hash entries

2002-07-22 Thread Sudarshan Raghavan
On Tue, 23 Jul 2002, dan wrote: > ok.. that worked, now how about if i wanted it to go the other way.. from > most to least? foreach my $MyId (sort {$usernum{$a} <=> $usernum{$b}} keys (%usernum)) { print "$MyId\n"; } This will print server.two.com server.four.com server.three.com server.one

Re: Net::SMTP

2002-07-22 Thread Sudarshan Raghavan
On Tue, 23 Jul 2002, Manya wrote: > Hi > I am new to Perl. > My prog. goes like this > > use Net::SMTP > > > --- > it gives the message can not locate Net/SMTP.pm in Have you installed Net::SMTP, it comes as a part of libnet package. If you have installed it check that the install d

Net::SMTP

2002-07-22 Thread Manya
Hi I am new to Perl. My prog. goes like this use Net::SMTP --- it gives the message can not locate Net/SMTP.pm in What is wrong? Please help Manya --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.350 / Virus Databas

Re: sorting %hash entries

2002-07-22 Thread dan
ok.. that worked, now how about if i wanted it to go the other way.. from most to least? dan "David Wagner" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Here is one shot: > > > %usernum = ( "server.one.com", "15", > "server.two.com", "5", > "server.three.co

RE: How to make @array2 use values of @array1?

2002-07-22 Thread nkuipers
What I am about to raise, I do so more out of wanting someone to educate me than disagreeing for the sake of. The *that syntax shown below is unfamiliar to me outside the context of referencing a filehandle in a subroutine params list, where it is optional (ie., &some_sub(*STDIN)). *that remi

How to make @array2 use values of @array1?

2002-07-22 Thread chris
I have two variables (@array1 and @array2). @array1 will be initialized with a list of values. Is it possible to declare @array2 in such a way that it will reference @array1? I am trying to avoid looping through the elements and copying over. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For ad

Re: sorting hash entries

2002-07-22 Thread victor
the command 'sort' allow you to put in your own routine to do sorting. %usernum = ("server.one.com" => "15", "server.two.com" => "5", "server.three.com" => "14", "server.four.com" => "9"); @arr = sort {$usernum{$a} <=> $usernum{$b}} (keys %usernum); print j

Re: regexp matching across newlines

2002-07-22 Thread Shawn
> I've tried with /g alone and also with /gs, /gm, and /gms. As long as /s is > one of the modifiers I do match one instance, but in no case do I match > multiple instances. Weird. Give this a try... while () { if(m/(p1).*?(p2)/gs) { print "match! found $1 and $2.\n"; } } The problem is

Re: regexp matching across newlines

2002-07-22 Thread David T-G
David -- ...and then David Newman said... % % > Yes, but your *. should be .* to work. When you have % % Sorry, typo. It is .* in the code! Ah. Well, then, there's more... % ... % > % Again, my goal is to match each instance of /(p1)*anything*(p2)/. % > % > I should think that % > % > u

Re: question about replacing ^M

2002-07-22 Thread Wiggins d'Anconia
Are you searching for M or using the single character when in vim? Single character being followed by this should at the / or in a substituition work. If that makes no sense I can try and explain it differently. This method also works when inputting the string into the Perl sub, however if

Re: sorting %hash entries

2002-07-22 Thread John W. Krahn
Dan wrote: > > I have a small query regarding how to sort hash entries in numerical order. > > %usernum { "server.one.com" "15", > "server.two.com" "5", > "server.three.com" "14", > "server.four.com" "9" } > > How can i get perl to ret

RE: sorting %hash entries

2002-07-22 Thread David . Wagner
Here is one shot: %usernum = ( "server.one.com", "15", "server.two.com", "5", "server.three.com", "14", "server.four.com", "9" ); foreach my $MyId (sort {$a->[1] <=>$b->[1]} map{[$_,$usernum{$_}]} keys %usernum) { printf "%-s\n", $My

Need help with package

2002-07-22 Thread chris
Here is what I am doing use A; my $this = {}; bless $this; my $result = $this->A::sub1 (my $args); Package A; sub1 { my $this = shift my ($data) = @_; my $result = $this->sub2($data); $this->sub2($data) does not load return "$result"; } sub2 { ... } I think I can understand why sub2 canno

RE: Perl on-line books

2002-07-22 Thread Stout, Joel R
I would check to see if this copy is legal before sending out the link again. ~Some~ Russian sites put pirated copies of books online. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

sorting hash entries

2002-07-22 Thread dan
(sorry if this message comes twice.. didn't appear to have sent the first time) I have a small query regarding how to sort hash entries in numerical order. %usernum { "server.one.com" "15", "server.two.com" "5", "server.three.com" "14",

sorting %hash entries

2002-07-22 Thread dan
I have a small query regarding how to sort hash entries in numerical order. %usernum { "server.one.com" "15", "server.two.com" "5", "server.three.com" "14", "server.four.com" "9" } How can i get perl to return these 4 server names in th

Re: Perl on-line books

2002-07-22 Thread Jim Agnew
There's perl in 21 days... found it by using google. http://194.106.118.30/ftp/Docs/Internet/Perl%205%20in%2021%20days/ Kaavla wrote: > > Any good perl on-line books that are available for free.. > My budget for learning perl is small.. So can't afford to buy the learning > Perl books.. > Any

RE: regexp matching across newlines

2002-07-22 Thread David Newman
> Yes, but your *. should be .* to work. When you have Sorry, typo. It is .* in the code! > % If I do (for example) "p1 p2 p1 p2\n\np1 p2", shouldn't the > while loop match > % on 3 instances? If not, what should I use to match each instance? > > Now that it's all one big line, you need /g to

RE: Interpreter

2002-07-22 Thread Omar Shariff
Hi Timothy --- Timothy Johnson <[EMAIL PROTECTED]> escribió: > > Para clarificacion, estas buscando la programa que > interpreta los scripts > creado en Perl, no? Si estas usando Windows, lo > puede encontrar aqui: > http://www.activestate.com. Se llama ActivePerl. > Si estas usando UNIX, se

Re: Position 251 ???

2002-07-22 Thread John W. Krahn
"John W. Krahn" wrote: > > Jenda Krynicky wrote: > > > > From: Konrad Foerstner <[EMAIL PROTECTED]> > > > > > I have a strange error in my script. It should > > > paint a column of lines next to each other in > > > colors which are determinated by a given sequence > > > of letters. It works...but

Re: question about replacing ^M

2002-07-22 Thread David T-G
Desmond -- ...and then Desmond Lee said... % ... % A sample from the file looks like this: % % while ( $row = $db->sql_fetchrow($result) );^M % $db->sql_freeresult($result);^M^M $total_threads = % count($threadrow);^M }^M else^M {^M % message_die(G

Re: regexp matching across newlines

2002-07-22 Thread David T-G
David -- ...and then David Newman said... % % many thanks... Here's hoping I can help, too :-) % % > Set $/ to undef instead. Good. % > ... % > > if (m/(p1)*.(p2)/ms) { ... % > When $/ is "", it's like the regex /\n{2,}/. % % wouldn't this have worked before, since the pattern was

Re: question about replacing ^M

2002-07-22 Thread Desmond Lee
Hi Tanton Thanks for the reply. I tried what you suggested, but i get no luck. So far i'm about 1/4 of the way through the file just doing it manually. Do you ahve any other suggestion? A sample from the file looks like this: while ( $row = $db->sql_fetchrow($result) );^M $db->sq

RE: regexp matching across newlines

2002-07-22 Thread David Newman
many thanks... > > >$/ = ''; > > Set $/ to undef instead. > > >while() { > > if (m/(p1)*.(p2)/ms) { > > print "match! I found $1 and $2\n."; > > } > >} this does work, but... > > When $/ is "", it's like the regex /\n{2,}/. wouldn't this have worked before, since t

Re: regexp matching across newlines

2002-07-22 Thread John W. Krahn
David Newman wrote: > > Consider a file containing this pattern: > > p1 > p2 > > I can match for p1 and p2 like this: > > $/ = ''; perldoc perlvar You are setting $/ to paragraph mode which is why the second example doesn't work. > while() { > if (m/(p1)*.(p2)/ms) {

Re: Position 251 ???

2002-07-22 Thread John W. Krahn
Jenda Krynicky wrote: > > From: Konrad Foerstner <[EMAIL PROTECTED]> > > > I have a strange error in my script. It should > > paint a column of lines next to each other in > > colors which are determinated by a given sequence > > of letters. It works...but only to the position > > of 251. After

Re: regexp matching across newlines

2002-07-22 Thread Jeff 'japhy' Pinyan
On Jul 22, David Newman said: >$/ = ''; Set $/ to undef instead. >while() { > if (m/(p1)*.(p2)/ms) { > print "match! I found $1 and $2\n."; > } >} When $/ is "", it's like the regex /\n{2,}/. If it's undef, then slurps the entire file at once. -- Jeff "japhy" Piny

regexp matching across newlines

2002-07-22 Thread David Newman
Consider a file containing this pattern: p1 p2 I can match for p1 and p2 like this: $/ = ''; while() { if (m/(p1)*.(p2)/ms) { print "match! I found $1 and $2\n."; } } However, the match fails if I change the pattern to: p1 p2 What I would like to do is mat

Re: question about replacing ^M

2002-07-22 Thread Tanton Gibbs
That ^M is the \r that is used by DOS based systems for EOL. Basically, DOS uses \r\n for EOL and Unix only uses \n. So, you have to eliminate all of the \r. If you have dos2unix on your system you can use that program otherwise do: perl -pi.bak -e 's/\r\n/\n/g' moby_threads_install.txt -

question about replacing ^M

2002-07-22 Thread Desmond Lee
Hi guys I'm trying to read a file, but it's just one massive line. I think that the ^M is suppose to be an indication that that's wehre teh newline is suppose to be. I've tried to replace ^M with a newline by executing something that i found on the web: perl -pi.bak -e 's/\^M/\n/g' moby_thre

Hi, newbie question

2002-07-22 Thread Desmond Lee
Hi guys I'm trying to read a file, but it's just one massive line. I think that the ^M is suppose to be an indication that that's wehre teh newline is suppose to be. I've tried to replace ^M with a newline by executing something that i found on the web: perl -pi.bak -e 's/\^M/\n/g' moby_thre

Re: Passing variable to sed command.

2002-07-22 Thread drieux
On Monday, July 22, 2002, at 10:21 , kent ho wrote: > Hi All, > Just a generic "sed" question, please help. > > How do I pass a variable to this sed command: > > MONTH="Mar" > sed '/$MONTH/,$d' foo > foo.new #!/bin/sh d="231" MONTH="Mar" sed '/'$MONTH'/,$d' foo

create annoymous hash here?

2002-07-22 Thread Paul Tremblay
I have a small array that looks like this: @array = qw(rtf1_deff fonttbl s33_up7) I generate this file from parsing an rtf file. I have to process each element in the array. I have to separte the letters from the numbers. So the first element would break down to "rtf" and "1". Based on the first

Re: Position 251 ???

2002-07-22 Thread Jenda Krynicky
From: Konrad Foerstner <[EMAIL PROTECTED]> > I cansee here no advandtage. But I left out some > details: I need to handle with capital and small letters > and the different letters will get differenz colors (no in groups). I > haven't tried your solution, because I can't find the solution for the

RE: Position 251 ???

2002-07-22 Thread Bob Showalter
> -Original Message- > From: Konrad Foerstner [mailto:[EMAIL PROTECTED]] > Sent: Monday, July 22, 2002 2:19 PM > To: [EMAIL PROTECTED] > Subject: Position 251 ??? > > > Hi, > > I have a strange error in my script. It should > paint a column of lines next to each other in > colors which

Re: Position 251 ???

2002-07-22 Thread Konrad Foerstner
I cansee here no advandtage. But I left out some details: I need to handle with capital and small letters and the different letters will get differenz colors (no in groups). I haven't tried your solution, because I can't find the solution for the my problem...perhaps you could explane it to me? K

Weekly posting statistics - 29/2002

2002-07-22 Thread Felix Geerinckx
Weekly posting statistics for perl.beginners - week 29 of 2002. >From Monday 2002-07-15 to Sunday 2002-07-21 there were 513 articles posted (24414 lines) by 133 authors, giving an average 3.86 articles per author, and an average article length of 48 lpa. The average number of articles per day w

Re: Position 251 ???

2002-07-22 Thread Jenda Krynicky
From: Konrad Foerstner <[EMAIL PROTECTED]> > I have a strange error in my script. It should > paint a column of lines next to each other in > colors which are determinated by a given sequence > of letters. It works...but only to the position > of 251. After this point all lines have the color >

Re: Passing variable to sed command.

2002-07-22 Thread David T-G
Kent -- ...and then kent ho said... % % Hi All, % Just a generic "sed" question, please help. Don't you think, then, that you'd be more likely to get a useful answer on a sed list?(!!?) % % How do I pass a variable to this sed command: % % MONTH="Mar" % sed '/$MONTH/,$d' foo > foo.new Use

Position 251 ???

2002-07-22 Thread Konrad Foerstner
Hi, I have a strange error in my script. It should paint a column of lines next to each other in colors which are determinated by a given sequence of letters. It works...but only to the position of 251. After this point all lines have the color of the line at position 251...even when I use a dif

Passing variable to sed command.

2002-07-22 Thread kent ho
Hi All, Just a generic "sed" question, please help. How do I pass a variable to this sed command: MONTH="Mar" sed '/$MONTH/,$d' foo > foo.new Thanks, Kent -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: NET

2002-07-22 Thread Janek Schleicher
Javeed Sar wrote at Mon, 22 Jul 2002 12:07:23 +0200: > Hi All, > > > I am using (given below) net use in batch files, how to do the same in >perl That is: > > net use u: /del > do net use u: The simplest solution is to call it like at the command line via backticks: `net use u: /d

Re: Perl || Php ?

2002-07-22 Thread George Schlossnagle
I think any of the inelegancies or benchmarks of either language are minor in comparison to the benefit of working in a language you are familiar with. That having been said, I would stay away from perl (or php) cgi, and stick with an embedded solution (mod_php for php, one of the embedded pe

Perl || Php ?

2002-07-22 Thread Yacketta, Ronald
Folks, I have come to a road block of sorts, I am currently working on a web front-end to a Oracle 8i DB. We are looking to allow users to enter their own quires generated via check boxes for tables and a simple step by step process to aid in the sql creation. I was wondering, wh

RE: Help starting out....

2002-07-22 Thread Meidling, Keith, CTR, OSD-C3I
I've used the following two books and they were great for learning. Beginning Perl by Simon Cozens. Wrox Publishing. ISBN: 1861003145 MySQL by Paul DuBois. New Riders Publishing. ISBN: 0735709211 I created a web frontend to a database and a couple other web apps with the two above books and help

RE: Interpreter

2002-07-22 Thread Timothy Johnson
Para clarificacion, estas buscando la programa que interpreta los scripts creado en Perl, no? Si estas usando Windows, lo puede encontrar aqui: http://www.activestate.com. Se llama ActivePerl. Si estas usando UNIX, se que lo puedes buscar en http://www.perl.org o http://www.cpan.org. Ahi tamb

Interpreter

2002-07-22 Thread Omar Shariff
Hi, i'm new here and in perl... i want to do a iterpreter for the university (like c) i found one for basic and prolog, but i don't understand, can anyone help me, with a little example or a web where i can found information... (there isn't money for books!!!). Thank you PD: sorry me english, in

Combining 1 to many dbs into one file

2002-07-22 Thread Anon
Hi there, I have two databases, One and Many. The One db has all the header information, and the Many db has all the detail line information associated with One db. I want to combine these two databases into one that has only one record/line item that has columns for the detail line item from the

Re: UPPERCASE and DOING MULTIPLE THINGS

2002-07-22 Thread drieux
On Monday, July 22, 2002, at 08:11 , Bob H wrote: > I have a script that is *supposed* to search a file and make certain > words that I have in an array uppercase. My brain is not grokking it. > > Q1: What is wrong with my script (below)? what sorts of error messages did you get? > === SCRIPT

RE: UPPERCASE and DOING MULTIPLE THINGS

2002-07-22 Thread Nikola Janceski
See inline comments > -Original Message- > From: Bob H [mailto:[EMAIL PROTECTED]] > Sent: Monday, July 22, 2002 11:12 AM > To: [EMAIL PROTECTED] > Subject: UPPERCASE and DOING MULTIPLE THINGS > > > I have a script that is *supposed* to search a file and make certain > words that I have

Re: UPPERCASE and DOING MULTIPLE THINGS

2002-07-22 Thread Jeff 'japhy' Pinyan
On Jul 22, Bob H said: >I have a script that is *supposed* to search a file and make certain >words that I have in an array uppercase. My brain is not grokking it. You should not use tr/// to make strings uppercase. Perl provides the uc() function for that. >Q1: What is wrong with my script (b

UPPERCASE and DOING MULTIPLE THINGS

2002-07-22 Thread Bob H
I have a script that is *supposed* to search a file and make certain words that I have in an array uppercase. My brain is not grokking it. Q1: What is wrong with my script (below)? Q2: Can I update a file in place? Q3: How do I run multiple things against one file in one script? === SCRIPT ===

Re: NET

2002-07-22 Thread Nigel Peck
You could just execute the same commands you already are (with backticks round them to make the shell handle them) `net use u: /del` `do net use u:` There may be some Win32:: modules on CPAN for mapping drives to do it a different way. TMTOWTDI. Nigel >>> Javeed SAR <[EMAIL PROTECTED]> 07/22/

Re: open() function

2002-07-22 Thread Jean-Luc BEAUDET
Daniel David a Ýcrit : > Hi , > > how do you open a file - starting at a particular line? > eg to start reading the file from line 500 ? > > thanks for your help. > > _ > MSN Photos is the easiest way to share and print your photos:

RE: populating hash from DBI

2002-07-22 Thread Bob Showalter
> -Original Message- > From: Scott Taylor [mailto:[EMAIL PROTECTED]] > Sent: Thursday, July 18, 2002 5:30 PM > To: [EMAIL PROTECTED] > Subject: RE: populating hash from DBI > > > At 02:20 PM 18/07/2002, Bob Showalter wrote: > > >Each pass through the loop overwrites %numlegs, so it will

Re: functions newbie

2002-07-22 Thread A Taylor
The reason this doesnt do what you expect it to do is because you are calling your function, which is then executing your SQL command and returning the first recordset. You are doing this over and over again - instead you should have some sort of loop in your function that loops through ALL the

Re: functions newbie

2002-07-22 Thread Shawn
Hello Charlie, [snip] > === > > This is my function attempting to do the same thing(?). > > sub Comment() { > > my( $sth ); > > $sth = $dbh->prepare("SELECT comment from dbtable > where com

functions newbie

2002-07-22 Thread Charlie Farinella
I'm trying to get a grip on functions. I want to connect to a database, execute a SELECT statement, and print each line where the criteria is met. This does what I want. my $comment; while ( $comment = $sth->fetchrow_array) { print "$comment\n"; } ===

NET

2002-07-22 Thread Javeed SAR
Hi All, I am using (given below) net use in batch files, how to do the same in perl That is: net use u: /del do net use u: Regards javeed -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: Q: Basic file operations...

2002-07-22 Thread Nathan Mattick
Hi folks, Thanks for all the replies, I've now finished the script. Nathan. -Original Message- From: Nathan Mattick Sent: Friday, July 19, 2002 2:38 PM To: [EMAIL PROTECTED] Subject: Q: Basic file operations... Could someone please help, how do I: [1] test whether a file exists bef