Re: perl script to convert dos newlines to unix newlines...

2002-12-13 Thread Ramprasad A Padmanabhan
Christopher J Bottaro wrote: hey, i wanna make a perl script that will convert those stupid "\r\n" dos newlines to good unix "\n" newlines...=) the problem isn't really a perl problem, but a general programming problem that i've always kinda wondered about. so i guess what i'm gunna do is op

passing a file handle as a sub arg...?

2002-12-13 Thread christopher j bottaro
hello, i want to make a sub that is to be used like this: my @array; open(INFILE, "blah"); ParseOneItem (INFILE, \@array); i know how to pass the array reference, but how do i pass the file handle? can i do it just like that? thanks, christopher -- To unsubscribe, e-mail: [EMAIL PROTECTED] Fo

getting defunct message

2002-12-13 Thread A. Johnson Jeba Asir
hello people, When I'm trying to server which listens on tcp port and forking child process i'm getting lot of defunct process when the server gets lots of requests . Can any body explains why this happens in general ? TIA Regards A.Johnson -- To unsubscribe, e-mail: [EMAIL PR

Re: perl multi-line matching

2002-12-13 Thread John W. Krahn
Jose Malacara wrote: > > Hello. I have a python script that I would like to convert to perl. In it > I am parsing a data file looking for occurences of three consecutive lines: > > series1 = """ > slot-1 UPUP t3-card > slot-2 UPUP madd2-card > slot-3

Re: UNIX Admin and Shell Perl resources

2002-12-13 Thread John W. Krahn
Jerry Rocteur wrote: > > Hi, Hello, > I like this list very much and I think it is very helpful! > > In my work and at home I spend most of my time at a UNIX prompt, either > Linux, Mac OS X, Solaris etc. > > I know the Korn shell very well and I can get by with Perl but I find > myself always

Re: regex help

2002-12-13 Thread John W. Krahn
Danny Grzenda wrote: > > DB4515C,625.25,378,327,382,352,805,163,513.5,699,257.88,,,"4,503","1,801",80 5 > > Trying to create a regex to substitute comas with pipes, except for the > commas between the double quotes. > > can't get one to work. You have to parse the data. Here is some code modif

RE: UNIX Admin and Shell Perl resources

2002-12-13 Thread Paul Ohashi
Hi Jerry, I subscribe to a few "Nothing but UNIX" groups. The site below should accommodate all of your needs. http://unix.ittoolbox.com/ Best regards, > Paul Ohashi > Technical Specialist > Quest Software, Inc. > (949) 754-8000 > www.quest.com/support > -Original Message- From: Je

Re: Split a text file

2002-12-13 Thread John W. Krahn
Marcelo wrote: > > Hi everybody ... Hello, > When I receive mail.. I can see it like a plain text file under > /var/spool/mail/marcelo where all the messages are concateneted one > after the other here is an example : > > From [EMAIL PROTECTED] Fri Dec 6 17:56:19 2002 > > [snip] > > A

RE: UNIX Admin and Shell Perl resources

2002-12-13 Thread Paul Kraus
Honestly buy learning Perl and programming Perl. Read them in this order. Learning PERL is an awesome starting point. Will teach you all the simple day to day things. Both books by Oreile. > -Original Message- > From: Jerry Rocteur [mailto:[EMAIL PROTECTED]] > Sent: Friday, December 13, 2

perl multi-line matching

2002-12-13 Thread Jose Malacara
Hello. I have a python script that I would like to convert to perl. In it I am parsing a data file looking for occurences of three consecutive lines: series1 = """ slot-1 UPUP t3-card slot-2 UPUP madd2-card slot-3 UPUP madd2-card""" or

Re: Execute perl program without seeing the code?

2002-12-13 Thread William.Ampeh
The last time I attempted this, I got soo fraastrated. If you can get perlexe to work, that is the way to go. __ William Ampeh (x3939) Federal Reserve Board -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: UNIX Admin and Shell Perl resources

2002-12-13 Thread William.Ampeh
http://www.tux.org/mailman/listinfo/ma-linux __ William Ampeh (x3939) Federal Reserve Board -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: UNIX Admin and Shell Perl resources

2002-12-13 Thread Mystik Gotan
I suggest you take a look @ http://lists.perl.org. They have all official mailing lists up there. And there are archives, too: http://archive.develooper.com (or archives, check it out yourself). Ooh, got some itch there ;-) -- Bob Erinkveld (Webmaster Insane Hosts) www.insane-host

UNIX Admin and Shell Perl resources

2002-12-13 Thread Jerry Rocteur
Hi, I like this list very much and I think it is very helpful! In my work and at home I spend most of my time at a UNIX prompt, either Linux, Mac OS X, Solaris etc. I know the Korn shell very well and I can get by with Perl but I find myself always doing stuff in ksh instead of Perl. I've rece

Re: obtaining a process ID.

2002-12-13 Thread Mark Goland
you can also look inside /proc although the data in there is mostly binary. PS just parses your proc directory. read up on PROCFS Mark - Original Message - From: <[EMAIL PROTECTED]> To: "zentara" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Friday, December 13, 2002 1:48 PM Subject:

RE: Returning from a PERL/CGI program...

2002-12-13 Thread Kipp, James
> > I'm new with PERL - I have a very simple PERL program that will accept > data from an HTML program and send it out as an email. In the HTML > program, the data items are filled in and then the PERL/CGI program is > called by a POST. The PERL/CGI program runs, the screen goes blank and > the em

Re: regex help

2002-12-13 Thread Jenda Krynicky
From: Adriano Rodrigues Ferreira <[EMAIL PROTECTED]> > >DB4515C,625.25,378,327,382,352,805,163,513.5,699,257.88,,,"4,503","1, > >801",805 > > > >Trying to create a regex to substitute comas with pipes, except for > >the commas between the double quotes. > > I think there is no regex which makes su

Returning from a PERL/CGI program...

2002-12-13 Thread Richard.C.1
I'm new with PERL - I have a very simple PERL program that will accept data from an HTML program and send it out as an email. In the HTML program, the data items are filled in and then the PERL/CGI program is called by a POST. The PERL/CGI program runs, the screen goes blank and the email is sent.

Re: regex help

2002-12-13 Thread Adriano Rodrigues Ferreira
> >DB4515C,625.25,378,327,382,352,805,163,513.5,699,257.88,,,"4,503","1,801",805 > >Trying to create a regex to substitute comas with pipes, except for the >commas between the double quotes. I think there is no regex which makes such a miracle. Maybe this has to do with the fact that regex are re

Re: regex help

2002-12-13 Thread Mystik Gotan
$var =~ s/^\,$/|/; -- Bob Erinkveld (Webmaster Insane Hosts) www.insane-hosts.net MSN: [EMAIL PROTECTED] From: Danny Grzenda <[EMAIL PROTECTED]> To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]> Subject: regex help Date: Thu, 12 Dec 2002 12:52:59 -0600 DB4515C,625.25,378,327,382,

Re: obtaining a process ID.

2002-12-13 Thread be.gomes
Thanks all for the suggestions. Looks like I'm stuck using the ps command. I'm writing this script on an appliance system with very limited perl modules loaded (can't load more because it needs to work on the appliance as it is shipped). I appreciate the feedback. -gomes On Thu, 12 Dec 2002

Extracting information using html form

2002-12-13 Thread Sukrit
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi listers, i am a perl beginner with an interesting problem (to me atleast :). Problem Overview - Somewhere on the world wide web, exists an asp page with the following form - On entering a valid roll number and pressing enter, re

Re: perl script to convert dos newlines to unix newlines...

2002-12-13 Thread Charles Galpin
On Fri, 13 Dec 2002, christopher j bottaro wrote: > hey, > i wanna make a perl script that will convert those stupid "\r\n" dos newlines > to good unix "\n" newlines...=) the problem isn't really a perl problem, but > a general programming problem that i've always kinda wondered about. > > so

Re: Indexed man pages?

2002-12-13 Thread David Eason
Apparently build 603 of ActiveState's version had exactly what you are asking for in HTMLHELP (.chm) format. It doesn't seem to be included anymore: http://aspn.activestate.com/ASPN/Perl/Products/ActivePerl/Changes.html If you want to try Beau's last suggestion, it may be easier than it sounds: ht

Re: Where to find missing examples

2002-12-13 Thread David Eason
Thank you, Bob. I have now downloaded the examples from CPAN (from the web browser, actually, not the CPAN shell). I was about to say ActiveState has ppm instead of CPAN, but you made me double check and it actually has both. Ran the helpful CPAN shell wizard, I am missing some of the executables

regex help

2002-12-13 Thread Danny Grzenda
DB4515C,625.25,378,327,382,352,805,163,513.5,699,257.88,,,"4,503","1,801",80 5 Trying to create a regex to substitute comas with pipes, except for the commas between the double quotes. can't get one to work. thanks Custom Technology Solutions http://www.ctssys.com Daniel G. Grz

RE: Split a text file

2002-12-13 Thread wiggins
This breaks down for many messages that have 2 "From"'s. Most messages start with a From not followed by a colon that is the envelope leader and include a From: (notice followed by a colon) that is in the message headers. I would suggest you not reinvent the wheel and check out the many modules

RESOLVED: Net::SFTP causes script to exit if connection can't be made

2002-12-13 Thread Ian Zapczynski
Sorry about the multiple messages on this. I was able to resolve my problem with Net::SSH::Perl die()ing if a connection fails by using the following: eval { $sftp = Net::SFTP->new($host, user=>$host, password=>$pass); }; then I check if $sftp is defined to decide whether or not to send

Re: perl script to convert dos newlines to unix newlines...

2002-12-13 Thread Gary Stainburn
On Friday 13 Dec 2002 10:42 am, christopher j bottaro wrote: > hey, > i wanna make a perl script that will convert those stupid "\r\n" dos > newlines to good unix "\n" newlines...=) the problem isn't really a perl > problem, but a general programming problem that i've always kinda wondered > about

Re: perl script to convert dos newlines to unix newlines...

2002-12-13 Thread Mystik Gotan
for ($i=0; $i<1024; $i++) { if ($var =~ /^\\r\\n$/) { $var =~ s/^\\r(\\n)$/$1/; } # First time using $1! Hope it works =) } Well, and the for loop ensures the file isn't bigger as 1024, 1mb. -- Bob Erinkveld (Webmaster Insane Hosts) www.insane-hosts.net MSN: [EMAIL PROTECTE

RE: Split a text file

2002-12-13 Thread Wagner, David --- Senior Programmer Analyst --- WGO
Here is a start. I put to an array, but you could write to a file: #!perl -w my @MyMail = ();# hold email my $MyHoldMail = '';# use to build each email msg my $In = 0; # count of lines my $MyProc = 0; # ready to process or not while ( ) {

Errno, POSIX, Forking and EAGAIN

2002-12-13 Thread wiggins
I am playing with a daemon that forks and am trying to be thorough as this will hopefully become production code. My daemon uses: use POSIX qw(:sys_wait_h :errno_h :signal_h); For some of the fork handling. Later I looked at the fork description from The Camel (3rd Edition - pg. 715) and then

Split a text file

2002-12-13 Thread Marcelo
Hi everybody ... When I receive mail.. I can see it like a plain text file under /var/spool/mail/marcelo where all the messages are concateneted one after the other here is an example : From [EMAIL PROTECTED] Fri Dec 6 17:56:19 2002 Return-Path: <[EMAIL PROTECTED]> Received: from insight

Re: More on Net::SFTP causes script to exit if connection can't be made

2002-12-13 Thread Ian Zapczynski
Ok, so I found that my problem appears to come from the following portion of Net::SSH ::Perl: connect($sock, sockaddr_in($rport, $raddr)) or die "Can't connect to $ssh->{host}, port $rport: $!"; Why should it die() and not just warn()? I found something that suggests I can intercept di

RE: Conditional Array lookup

2002-12-13 Thread Wagner, David --- Senior Programmer Analyst --- WGO
Should use warnings for you have @exculde; which is not what you loaded data with. Wags ;) -Original Message- From: Paul Kraus [mailto:[EMAIL PROTECTED]] Sent: Friday, December 13, 2002 08:07 To: 'Bob Showalter'; 'Perl' Subject: RE: Conditional Array lookup I don't think I under

Re: Net::SFTP causes script to exit if connection can't be made

2002-12-13 Thread Ian Zapczynski
Unfortunately, using the || as below doesn't change the behavior. Once my script tries to make the connection and can't, it exists with a "connection failed to $host, etc. etc." message, whether I use warnings or diagnostics or neither. If anyone can help me understand why this may be or if t

RE: Conditional Array lookup

2002-12-13 Thread Paul Kraus
I don't think I understand this. per perldoc and your instruction this should work. my @exclude = qw /du huh . ../; %exclude = map {$_=>1} @exculde; print "$_\n" foreach (@exclude); # Prints array print "$k $v\n" while (($k,$v) = each %exclude); #prints nothing. Paul > -Original Message--

Re: FW: Preserving funny characters in email addresses

2002-12-13 Thread R. Joseph Newton
perldoc -f pack [used in almost any standard header-parsing routine] Joseph "Johnstone, Colin" wrote: > Toby, anyone, > > My next question is I guess I need to know now why this happens? > > So that I can anticipate it and code for it in the future. > > e.g sorcha.o'[EMAIL PROTECTED] > > So why

RE: Conditional Array lookup

2002-12-13 Thread Bob Showalter
> -Original Message- > From: Paul Kraus [mailto:[EMAIL PROTECTED]] > Sent: Friday, December 13, 2002 10:19 AM > To: 'Perl' > Subject: Conditional Array lookup > > > Is there a way to do an if or unless against an entire array. > > @exclude = > > #compare $soomevaraible to every ele

Re: Conditional Array lookup

2002-12-13 Thread Rob Dixon
Paul unless grep ($somevariable == $_, @exclude) Rob - Original Message - From: "Paul Kraus" <[EMAIL PROTECTED]> To: "'Perl'" <[EMAIL PROTECTED]> Sent: Friday, December 13, 2002 3:18 PM Subject: Conditional Array lookup > Is there a way to do an if or unless against an entire arra

Re: Readdir to array

2002-12-13 Thread Mystik Gotan
I'd be using: #!/usr/bin/perl -w $dir = "/backup"; opendir BACKUPDIR, $dir or die "Cannot open $dir!"; foreach (readdir BACKUPDIR){ unless ($_ eq "." or $_ eq ".."){ #print "$_"; push (@dirs,$_); } foreach (@dirs) { print "$_\n"; } } -- Bob Erinkveld (Webmaster Insa

RE: Conditional Array lookup

2002-12-13 Thread wiggins
perldoc -f map perldoc -f grep http://danconia.org On Fri, 13 Dec 2002 10:18:30 -0500, "Paul Kraus" <[EMAIL PROTECTED]> wrote: > Is there a way to do an if or unless against an entire array. > > @exclude = > > #compare $soomevaraible to ev

RE: Readdir to array

2002-12-13 Thread Paul Kraus
doht! Thanks! > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > Sent: Friday, December 13, 2002 10:13 AM > To: Paul Kraus; Perl > Subject: RE: Readdir to array > > > You are foreah'ing in your foreach. So it is printing the > contents of the array foreach of t

Conditional Array lookup

2002-12-13 Thread Paul Kraus
Is there a way to do an if or unless against an entire array. @exclude = #compare $soomevaraible to every element of @exclude. unless ($somevariable eq @exclude){ ... } Paul Kraus Network Administrator PEL Supply Company 216.267.5775 Voice 216-267-6176 Fax www.pelsupply.com -- To

Re: Execute perl program without seeing the code?

2002-12-13 Thread Adriano Rodrigues Ferreira
I know little about Unix, but this will hopefully works. Maybe if you are interested about some subtle ways to hide your code even in a system which just can't close the doors for unwanted visitors (like Windows Me), you can find useful to take a look at: perldoc -m perlfilter Good lu

RE: Readdir to array

2002-12-13 Thread wiggins
You are foreah'ing in your foreach. So it is printing the contents of the array foreach of the files in the directory... http://danconia.org On Fri, 13 Dec 2002 09:56:19 -0500, "Paul Kraus" <[EMAIL PROTECTED]> wrote: > for some reason the outpu

Re: declaring variables

2002-12-13 Thread Mystik Gotan
Stuff the variable names into an array, use a regex to delete all the slashes (as you will declare the names with a slash in front of it). Or anything like that. Actually, I think the syntax is ok. I'm sure local() can do this, so why can't my? Just try to accomplish something else with this con

Re: Calling another perl script

2002-12-13 Thread Joe Mecklin
exec() exits the calling program and does not return. system() returns the called program's exit status then allows the calling program to resume execution. "Programming Perl", 3rd Edition, p.811 On Fri, 2002-12-13 at 08:01, Paul Kraus wrote: > if I exec a Perl script from a Perl script that fir

RE: Execute perl program without seeing the code?

2002-12-13 Thread Bob Showalter
> -Original Message- > From: Dennis HO Siu-chung [mailto:[EMAIL PROTECTED]] > Sent: Friday, December 13, 2002 4:01 AM > To: [EMAIL PROTECTED] > Subject: Execute perl program without seeing the code? > > > Can I let someone execute my perl code without seeing the > code on UNIX system? >

Readdir to array

2002-12-13 Thread Paul Kraus
for some reason the output is different for this script. If I print $_ I get the correct list. If I print the Array I get roughly the same list 4 times? #!/usr/bin/perl -w $dir = "/backup"; opendir BACKUPDIR, $dir or die "Cannot open $dir!"; foreach (readdir BACKUPDIR){ unless ($_ eq "." or $_

Re: Calling another perl script

2002-12-13 Thread Sudarshan Raghavan
Paul Kraus wrote: > I want the parent process to end. I am just trying to decide if I can > start a second script without having to tie them together in a batch > file. exec overlays the memory image of the calling process, i.e. the calling process is gone after the call to exec. I wouldn't exact

RE: include .pl in html

2002-12-13 Thread Ramón Chávez
It's easy. Use SSI (Server Side Includes) As Ken said: But maybe you may change the .html extension to .shtml -rm- - Original Message - From: Ken Lehman <[EMAIL PROTECTED]> To: 'Adam Wilson' <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Wednesday, December 11, 2002 2:41 PM Subject: RE

RE: Calling another perl script

2002-12-13 Thread Paul Kraus
I want the parent process to end. I am just trying to decide if I can start a second script without having to tie them together in a batch file. > -Original Message- > From: Kipp, James [mailto:[EMAIL PROTECTED]] > Sent: Friday, December 13, 2002 9:15 AM > To: 'Paul Kraus'; 'Perl' > Subje

RE: Calling another perl script

2002-12-13 Thread Kipp, James
I rarely use 'exec' but i believe the parent script just exits . here is some more from the docs: Since it's a common mistake to use "exec" instead of "system", Perl warns you if there is a following statement which isn't "die", "warn", or "exit" (if "-w" is set - but you always do that). If you

RE: Regex question

2002-12-13 Thread Paul Kraus
Crap I read that wrong. I was thinking like you noticed of not having to escape the "forward" slash. My bad :) > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > Sent: Friday, December 13, 2002 8:56 AM > To: [EMAIL PROTECTED] > Subject: RE: Regex question > > >

RE: Calling another perl script

2002-12-13 Thread Paul Kraus
I understand this. However may concern is what is the parent app doing while the exec program runs. I know it returns nothing and dumps to shell when its finished but when is the first program released? Maybe I am not understanding you it is rather early :-) > -Original Message- > From: Ki

Re: Regex question

2002-12-13 Thread John W. Krahn
Paul Kraus wrote: > > > From: John W. Krahn [mailto:[EMAIL PROTECTED]] > > > > Yes that will work although you don't need to backslash the > > quote in the regular expression. > > > > $ perl -le'$_ = q[one "two" three]; s{"}{\\"}g; print' > > one \"two\" three > > Correct me if I am wrong but the

RE: Calling another perl script

2002-12-13 Thread Kipp, James
perldoc -f exec exec LIST exec PROGRAM LIST The "exec" function executes a system command *and never returns*-- use "system" instead of "exec" if you want it to return. It fails and returns false only if the command does not exist *and* it is executed directly inste

Calling another perl script

2002-12-13 Thread Paul Kraus
if I exec a Perl script from a Perl script that first program will end and then start the second or will it continue to run until both programs have finished? Paul Kraus Network Administrator PEL Supply Company 216.267.5775 Voice 216-267-6176 Fax www.pelsupply.com -- To unsubscribe, e-mail: [EM

RE: Regex question

2002-12-13 Thread wiggins
On Fri, 13 Dec 2002 08:30:24 -0500, "Paul Kraus" <[EMAIL PROTECTED]> wrote: > Correct me if I am wrong but the only time you need to escape a > backslash is if your regexpr is started and terminated with it. Since > you are using {} I don't think y

RE: Regex question

2002-12-13 Thread Paul Kraus
Correct me if I am wrong but the only time you need to escape a backslash is if your regexpr is started and terminated with it. Since you are using {} I don't think you need to do that. > -Original Message- > From: John W. Krahn [mailto:[EMAIL PROTECTED]] > Sent: Friday, December 13, 2002

Re: Regex question

2002-12-13 Thread John W. Krahn
Colin Johnstone wrote: > > Gidday all, Hello, > I have a paragraph of text, I want to convert any double quotes around > quoted text to \" is this the correct reg ex > > $paragraph =~ s{\"}{\\"}g; Yes that will work although you don't need to backslash the quote in the regular expression. $ p

Re: declaring variables

2002-12-13 Thread John W. Krahn
Mariusz wrote: > > In one of my scripts I have lots of variables to declare. I wanted to type them in >groups instead of one long line but I think dividing my lines trough the use of the >ENTER key stops the script from working. (Although when I check the syntax through >"perl - c script.cgi" i

Re: process managing in Perl

2002-12-13 Thread zentara
On Thu, 12 Dec 2002 17:43:34 +0100, [EMAIL PROTECTED] (Olivier Moulene) wrote: >I have the pid of one running process and i want to kill it and all its children. >What can i do to know the pids of every children ? This untested code from perlmonks.org, it might give you some ideas. What you are a

Extracting plain text from MS Word Document

2002-12-13 Thread Aman Thind
Hi I need to extract the text from a word document. I know how to : Print a word document using the default printer : - use strict; use Win32::OLE; u

Re: arrays and references etc....

2002-12-13 Thread Sudarshan Raghavan
Kris Gaethofs wrote: > Hi, > > I could use some help with the following problem: > > I have this input file that looks like this (after some processing): > > %1%MO%1s%.%-.0003%.%.0003%.0002%.0006%-.0005%.0020%-.0035%.0006 > %2%MO%1s%-.0001%-.0021%-.0003%.0018%.0015%.0042%-.0034%.0136%-.023

perl script to convert dos newlines to unix newlines...

2002-12-13 Thread christopher j bottaro
hey, i wanna make a perl script that will convert those stupid "\r\n" dos newlines to good unix "\n" newlines...=) the problem isn't really a perl problem, but a general programming problem that i've always kinda wondered about. so i guess what i'm gunna do is open the file, read in a line, sea

arrays and references etc....

2002-12-13 Thread Kris Gaethofs
Hi, I could use some help with the following problem: I have this input file that looks like this (after some processing): %1%MO%1s%.%-.0003%.%.0003%.0002%.0006%-.0005%.0020%-.0035%.0006 %2%MO%1s%-.0001%-.0021%-.0003%.0018%.0015%.0042%-.0034%.0136%-.0234%.0042 %3%MO%1s%-.0005%-.0085%-.00

Execute perl program without seeing the code?

2002-12-13 Thread Dennis HO Siu-chung
Can I let someone execute my perl code without seeing the code on UNIX system? e.g. chmod 711 perlprog.pl -Dennis -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]