Re: networking with perl

2003-03-27 Thread Soumyadeep nandi
Hi, As my network program on sun solaris was giving problem with the error: malformed header from script. Bad header=BLASTN 2.2.4 [Aug-26-2002]: /usr/local/apache/cgi-bin/local/ file3.cgi I tried with another linux machine it worked fine. That is, after sending the request to the linux machine I

Splitting & slurping a text file into two arrays

2003-03-27 Thread Dennis . Warren
Hi everyone, I'm a hopeless hacker of Perl, and I tend to think in AWK-ish ways, simply because I know awk loads better than Perl. Awk has unfortunately taught me to think purely in terms of fields... If I have a text file where the field separator is a new line and the record separator is a blan

Split Problem

2003-03-27 Thread Jimstone77
I'm having a problem splitting a variable and need some help. What I have is some variables with a name, and then information in parens. A couple examples: $data = "David (man from uncle)"; $data = "John Doe (The boy down the hall)"; What I want to do is split $data into two string variab

Re: Split Problem

2003-03-27 Thread Aim
Hi, Somethig like this should work (untested): my ( $name, $info ) = split /\(/, $data; regards, Aim. [EMAIL PROTECTED] wrote: > I'm having a problem splitting a variable and need some help. What I have is > some variables with a na

Re: Split Problem

2003-03-27 Thread Janek Schleicher
Jimstone7 wrote at Thu, 27 Mar 2003 06:39:25 -0500: > $data = "David (man from uncle)"; > > $data = "John Doe (The boy down the hall)"; > > What I want to do is split $data into two string variables, one holding the > $name, and the other holding all the $info that is within the parens. How

Re: Splitting & slurping a text file into two arrays

2003-03-27 Thread Rob Dixon
Hi Dennis. Dennis Warren wrote: > Hi everyone, > > I'm a hopeless hacker of Perl, and I tend to think in AWK-ish ways, simply > because I know awk loads better than Perl. What do you mean by 'awk loads better'? Beware that my Unix isn't especially strong! > Awk has unfortunately taught me to thi

Re: how can I delete a line?

2003-03-27 Thread Adriano Allora
Hello, thank you all, at this moment I don't need a solution involving anything neither nuclear fly swatters: I show the hammer to the bolt and that became a nail. I needed something a bit more kinky that I told you in the first mail - to delete all the posts too much short in a very long newsgr

Re: Split Problem

2003-03-27 Thread Rob Dixon
Janek Schleicher wrote: > Jimstone7 wrote at Thu, 27 Mar 2003 06:39:25 -0500: > > > $data = "David (man from uncle)"; > > > > $data = "John Doe (The boy down the hall)"; > > > > What I want to do is split $data into two string variables, one holding the > > $name, and the other holding all the

Re: Split Problem

2003-03-27 Thread Stefan Lidman
Janek Schleicher wrote: > > Jimstone7 wrote at Thu, 27 Mar 2003 06:39:25 -0500: > > > $data = "David (man from uncle)"; > > > > $data = "John Doe (The boy down the hall)"; > > > > What I want to do is split $data into two string variables, one holding the > > $name, and the other holding all

Two small string questions

2003-03-27 Thread Christian Calónico
Hi, I need some help working with strings. Suppose that I have $block that's a string of 512 bytes. 1) How can I have only one byte from it (i.e. i want the third byte)? 2) How can I get the first n bytes of the string in another string (substring), deleting them from the beginning of the origi

perl & registry editing

2003-03-27 Thread Rosenstein, Leon
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi everyone, I am using the win32 environment (Windows 2000 SP3 specifically): Could anyone tell me how I could use perl to edit the registry? Do I need some kind of module? Is there a website or link anyone can provide? TIA, Leon -BEGIN P

Re: Two small string questions

2003-03-27 Thread Stefan Lidman
Christian Calónico wrote: > > Hi, I need some help working with strings. Suppose that I have $block > that's a string of 512 bytes. > 1) How can I have only one byte from it (i.e. i want the third byte)? 2) How > can I get the first n bytes of the string in another string (substring), > deleting t

reading from file

2003-03-27 Thread Christian Calónico
If I'm reading from a file (suppose that it haves 1124 bytes) in this way: open IN, "data2.txt" or die $!; $/ = \512; while( my $block = ) { ... } 1) Two iterations reads 1024 bytes. The third iteration is possible? How can I read the last 100 bytes? 2) Is there any way to change dinamically $/

Re: perl & registry editing

2003-03-27 Thread Jenda Krynicky
From: "Rosenstein, Leon" <[EMAIL PROTECTED]> > I am using the win32 environment (Windows 2000 SP3 specifically): > > Could anyone tell me how I could use perl to edit the registry? Do I > need some kind of module? Yes. You can use either Win32::Registry, Win32API::Registry and Win32::TieRegistr

Re: reading from file

2003-03-27 Thread Jenda Krynicky
From: Christian Calónico <[EMAIL PROTECTED]> > If I'm reading from a file (suppose that it haves 1124 bytes) in this > way: > > open IN, "data2.txt" or die $!; > $/ = \512; > while( my $block = ) > { > ... > } > > 1) Two iterations reads 1024 bytes. The third iteration is possible? > How can I rea

RE: reading from file

2003-03-27 Thread Bob Showalter
Christian Calónico wrote: > If I'm reading from a file (suppose that it haves 1124 bytes) in this > way: > > open IN, "data2.txt" or die $!; > $/ = \512; > while( my $block = ) > { > ... > } > > 1) Two iterations reads 1024 bytes. The third iteration is possible? > How can I read the last 100 b

Statement execution...

2003-03-27 Thread Richard.C.1
I think I'm right, but I want to verify it. I'm learning PERL on my own and "decomposing" some programs to see how they "flow". My question is - given the following program "structure", what will print out? Print "one" Subroutine aa print "two" End Print "three" Print "four" Subroutine bb pr

Re: Statement execution...

2003-03-27 Thread Pete Emerson
Here you go, and your guess as to what prints out is right on; subroutines don't run until they're called, and placement in this situation doesn't affect anything. #!/usr/bin/perl -w use strict; print "one\n"; sub aa { print "two\n"; } print "three\n"; print "four\n"; sub bb { prin

Re: Split Problem

2003-03-27 Thread Janek Schleicher
Stefan Lidman wrote at Thu, 27 Mar 2003 13:55:27 +0100: > Janek Schleicher wrote: >> I would use a regexp: >> >> my ($name, $info) = $data =~ /(.*?)\w+\((.*)\)/; > > I guess you ment: > my ($name, $info) = $data =~ /(.*?)\s*\((.*)\)/; Yep. Cheerio, Janek -- To unsubscribe, e-mail: [EMAIL PR

Re: Split Problem

2003-03-27 Thread Janek Schleicher
Rob Dixon wrote at Thu, 27 Mar 2003 12:51:46 +: > Janek Schleicher wrote: >> > $data = "David (man from uncle)"; >> > >> > $data = "John Doe (The boy down the hall)"; >> > >> > What I want to do is split $data into two string variables, one holding the >> > $name, and the other holding all

Re: Split Problem

2003-03-27 Thread Rob Dixon
Janek Schleicher wrote: > Rob Dixon wrote at Thu, 27 Mar 2003 12:51:46 +: > > > > > I'm afraid your regex is wrong! It does the following: > > Yep, it was a typo and untested. > > > capture zero or more (as few as possible) of any character > > !! match one or more 'word' characters follow

RE: Splitting & slurping a text file into two arrays

2003-03-27 Thread Dennis . Warren
Thanks Rob, that helps me. >What do you mean by 'awk loads better'? I mean that I know awk better than I know Perl. In this context 'loads' means 'a lot', rather than transfer into memory or any other such computerese. BTW I found I could also do it in the following way the following, but I knew

Re: Splitting & slurping a text file into two arrays

2003-03-27 Thread Rob Dixon
Dennis Warren wrote: > Thanks Rob, that helps me. > > > What do you mean by 'awk loads better'? > I mean that I know awk better than I know Perl. > In this context 'loads' means 'a lot', rather than transfer into memory or > any other such computerese. Ah! Sorry - I guess I expected the other leam

Re: Statement execution...

2003-03-27 Thread Rob Dixon
Richard C 1 wrote: > I think I'm right, but I want to verify it. I'm learning PERL on my own > and "decomposing" some programs to see how they "flow". My question is - > given the following program "structure", what will print out? > > Print "one" > Subroutine aa > print "two" > End > Print "thre

LABELS, forks and foreach loops.....

2003-03-27 Thread chad kellerman
Hello, Got a little issue. Tyring ot under stand how things work but just not getting it. I am forking each element of the array . I have a maximum child count of 8. Which works. What I was wondering is if I get into the if statement in the until loop. How do I exit the pid clean up a

Re: LABELS, forks and foreach loops.....

2003-03-27 Thread Rob Dixon
Hi Chad. Chad Kellerman wrote: > Hello, > >Got a little issue. Tyring ot under stand how things work but just not > getting it. I am forking each element of the array . I have a maximum child > count of 8. Which works. What I was wondering is if I get into the if > statement in the until

NewBie Question! Please Help

2003-03-27 Thread Palm Optins
Hi All, I writting a script so when members join my program it writes their Email Address into a flat file. I have it adding to the file this way. open (FILE, ">>$cgiroot/memdata/address/members.txt"); flock(FILE, 2); print FILE "$list\n"; flock(FILE, 8); close (FILE); What I need to know, and

Re: NewBie Question! Please Help

2003-03-27 Thread Rob Dixon
Palm Optins wrote: > Hi All, > > I writting a script so when members join my program it writes their Email Address > into a > flat file. > I have it adding to the file this way. > > open (FILE, ">>$cgiroot/memdata/address/members.txt"); > flock(FILE, 2); > print FILE "$list\n"; > flock(FILE, 8);

String removal

2003-03-27 Thread Christian Calónico
Hello. I need to know how to remove a substring from a string and a how to remove a simple character occurrence from a string. Thanks in advance! Christian. _ Charla con tus amigos en línea mediante MSN Messenger: http://messenger.y

Re: NewBie Question! Please Help

2003-03-27 Thread Rob Dixon
Palm Optins wrote: > Hi All, > > I writting a script so when members join my program it writes their Email Address > into a > flat file. I have it adding to the file this way. It's better to do use Fcntl ':flock'; to get the names for the different lock vakues, then you can write: > open

RE: String removal

2003-03-27 Thread Kipp, James
> > > Hello. > I need to know how to remove a substring from a string and a how > to remove a simple character occurrence from a string. Thanks > in advance! > Christian. > perldoc -f substr perldoc -f splice perldoc perlre -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional comma

Re: NewBie Question! Please Help

2003-03-27 Thread Brett W. McCoy
On Thu, 27 Mar 2003, Palm Optins wrote: > I writting a script so when members join my program it writes their > Email Address into a flat file. I have it adding to the file this way. > > open (FILE, ">>$cgiroot/memdata/address/members.txt"); > flock(FILE, 2); > print FILE "$list\n"; > flock(FILE,

Re: LABELS, forks and foreach loops.....

2003-03-27 Thread chad kellerman
Rob, Thanks for the help. I did what you suggested and cleaned up the code. But I am getting some strange errors: Use of uninitialized value in numeric gt (>) at ./script.pl line #. foreach $hostId ( @hostIds ) { my $pid = undef;

Re: LABELS, forks and foreach loops.....

2003-03-27 Thread Rob Dixon
Chad Kellerman wrote: > Rob, > >Thanks for the help. I did what you suggested and cleaned up the code. > But I am getting some strange errors: > > Use of uninitialized value in numeric gt (>) at ./script.pl line #. > > foreach $hostId ( @hostIds ) { > > my $pid = undef; > > $pid = fork

RE: LABELS, forks and foreach loops.....

2003-03-27 Thread Mark Anderson
--- Original message --- foreach $hostId ( @hostIds ) { my $pid = undef; $pid = fork if $CHILD_PIDS < $MAX_CHILDREN; if( $pid > 0 ) { $CHILD_PIDS++; #Add the children up until we hit the

using constant value in as a command variable

2003-03-27 Thread Tony Esposito
I can resolve a constant in a print statement like so: use constant QX12_FILE => "q_x12_in.dat"; ... print STDERR "could not change permissions on file @{[ QX12_FILE ]}: $!"; but how to resolve the constant when being used in a function call, like so: use constant QX12_FILE => "q_x12_in.dat"; ..

Re: using constant value in as a command variable

2003-03-27 Thread Jenda Krynicky
From: Tony Esposito <[EMAIL PROTECTED]> > I can resolve a constant in a print statement like so: > > use constant QX12_FILE => "q_x12_in.dat"; > ... > print STDERR "could not change permissions on file @{[ QX12_FILE ]}: > $!"; > > but how to resolve the constant when being used in a function call

Re: screen size question

2003-03-27 Thread Jeff Westman
I'm sure there are more elegant soultions, but this works: perl -e ' @x = qx(stty -a); @y = split(/\s/, $x[1]); $y[2] =~ s/;//; print "screen size is $y[2] x $y[5]" ' "stty -a" works on every *nix system I know. Some systems have 'stty -size' to help with exactly what you are asking.

Re: using constant value in as a command variable

2003-03-27 Thread Rob Dixon
Jenda Krynicky wrote: > From: Tony Esposito <[EMAIL PROTECTED]> > > I can resolve a constant in a print statement like so: > > > > use constant QX12_FILE => "q_x12_in.dat"; > > ... > > print STDERR "could not change permissions on file @{[ QX12_FILE ]}: > > $!"; > > > > but how to resolve the const

RE: using constant value in as a command variable

2003-03-27 Thread Tony Esposito
Thanks for all your input. I have used one of these methods and it worked well. Problem solved :-) > Anthony (Tony) Esposito > Senior Technical Consultant > Inovis(tm), formerly Harbinger and Extricity > 2425 N. Central Expressway, Suite 900 > Richardson, TX 75080 > (972) 643-3115 > [EMA

Re: screen size question

2003-03-27 Thread Jimstone77
In a message dated 3/27/03 5:41:14 PM Eastern Standard Time, [EMAIL PROTECTED] writes: > perl -e ' > @x = qx(stty -a); > @y = split(/\s/, $x[1]); > $y[2] =~ s/;//; > print "screen size is $y[2] x $y[5]" > ' > > "stty -a" works on every *nix system I know. Some systems have 'stty -siz

RE: screen size question

2003-03-27 Thread Jeff Westman
Good info Peter. As a side note too, this group is about "beginners", or basic perl, or those things pertaining to perl that we all need help on every now and then. I don't think the focus is CGI programming per se, but perl in general. It's a great group, and I personally have benefited tremend

Re: screen size question

2003-03-27 Thread John W. Krahn
[EMAIL PROTECTED] wrote: > > In a message dated 3/27/03 5:41:14 PM Eastern Standard Time, > [EMAIL PROTECTED] writes: > > > perl -e ' > > @x = qx(stty -a); > > @y = split(/\s/, $x[1]); > > $y[2] =~ s/;//; > > print "screen size is $y[2] x $y[5]" > > ' > > > > "stty -a" works on every *nix

Re: String removal

2003-03-27 Thread Victor Tsang
$TheOriginalString =~ s/$StringOrCharToRemove//g; Tor. Christian Calónico wrote: > > Hello. > I need to know how to remove a substring from a string and a how > to remove a simple character occurrence from a string. Thanks in advance! > Christian. > > _

hello

2003-03-27 Thread Todd
Hello everyone, I imagine you see emails like this frequently, but I am looking for some tips. I'd like to know some good technics for beginners to perl, and what steps they should take to get involved and start to understand the basic concepts of perl, if anyone could reply with how they star

Re: hello

2003-03-27 Thread Jeff Westman
An excellent starting point is the camel book, "Learning Perl", by Randal Schwartz & Tom Christiansen. Don't let the title fool you -- it's a solid reference too --- Todd <[EMAIL PROTECTED]> wrote: > Hello everyone, > > I imagine you see emails like this frequently, but I am looking for so

dup2 and IPC

2003-03-27 Thread Mark G
hi all, I am having a problem with duping stdout and socket. When my client forks of children, the childrens stdout is then duped with a socket. Which is what I want, but for some reason the parents stdout gets redirected as well. I want the parents STDOUT to stay the same and only redirect chi

perl DBI and mysql

2003-03-27 Thread jaws
Hi all, i am new to perl and i want to use it with DBI:mysql module. I want to connect to my sql server and do some data manipulation like , insert, update and delete. I read the DBI documention but i cant get through to get my script working. any help is needed. below is my script. #!/usr/bin

Synchronization of FTP servers

2003-03-27 Thread Aman Thind
Hi This is a typical situation in companies with development teams spread around the globe. I have FTP servers - in India , US & Switzerland. Builds are being made in India and being put on the Indian server. Any tips how I could transfer the contents to the remote servers ? I've been using Ne

RE: hello

2003-03-27 Thread Kanchi, Rajesh (MLODC, Covansys - CHENNAI)
I just started learning perl with this book and looks very very good. -Original Message- From: Jeff Westman [mailto:[EMAIL PROTECTED] Sent: Friday, March 28, 2003 9:17 AM To: beginners Subject: Re: hello An excellent starting point is the camel book, "Learning Perl", by Randal Schwartz &