RE: Regarding reg. expr

2002-03-21 Thread Timothy Johnson
Sweet. I always forget about the little things Perl does for you in the background. -Original Message- From: kim, kiseok To: [EMAIL PROTECTED] Sent: 3/21/02 11:00 PM Subject: Re: Regarding reg. expr $. is line number of the last file handle :-) so, my $counter; while(){ if($_ =~

Printing frequency of word occurence in paragraph

2002-03-21 Thread Bruce Ambraal
In the program below I don't know when to stop the loop. (CTRL + d ) will just terminate the program, leaving the data via STDIN unattended, this is my problem. Lets define what I want to do: I want to print the frequency of every word at the beginning. and every word at the end of a line. Th

Re: Regarding reg. expr

2002-03-21 Thread kim, kiseok
$. is line number of the last file handle :-) so, my $counter; while(){ if($_ =~ /(\b$input\b)/){ print "Found match on line number $.\n"; } } "Timothy Johnson" <[EMAIL PROTECTED]> wrote in message C0FD5BECE2F0C84EAA97D7300A500D500258116F@SMILEY">news:C0FD5BECE2F0C84EAA97D7300A50

RE: Regarding reg. expr

2002-03-21 Thread Timothy Johnson
With an array of that size, is it coming from a file? If so, you can do something like this to cut down on memory usage, which will speed up the process. I'm not the expert on regexes, but I believe there is also a way to have the regex compiled only once. my $counter; while(){ $counter++;

RE: Regarding reg. expr

2002-03-21 Thread Timothy Johnson
Perhaps something like this: my $counter; foreach(@rootwords){ $counter++; $_ .= "\n"; if($_ =~ /(\b$input\b)/){ print "Found match on line number $counter\n"; } } At least I think that's what you're looking for. -Original Message- From: viswanathan sundararajan To:

Regarding reg. expr

2002-03-21 Thread viswanathan sundararajan
Hi group, I have the following code. $in=join("\n",@rootwords); while($in=~/(\b$input\b)/g) { . . } Is there any way of finding out the line no where $input is matched with $in.$in may contains many instances of $in.I need all those line nos. Thanx in advance, vi

RE: calling /path/to/dir from variable

2002-03-21 Thread Timothy Johnson
Have you tried printing ">/path/to/$line/dir/thefile" to the screen to make sure it's printing what you expect? -Original Message- From: GREGOR [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 21, 2002 6:36 PM To: perl-win32 Subject: calling /path/to/dir from variable hi all, I've bee

Re: Help Required - Search and Replace

2002-03-21 Thread Jonathan E. Paton
> >my $word = "WORD"; > > > >while (<>) { > >s/$word/lie/g; #Slow > >} > > > >is slow because that $word forces the regex to > >be recompiled each time through. The best way > >to solve this problem is to create a Perl > >script on the fly and run using eval $script; > > Not true about that

Re: Net::FTP::Common - get(RemoteFile => ?)

2002-03-21 Thread Brian Volk
Thanks Elaine. I emailed T. M. Brannon. In the mean time I gonna stict to LWP::Simple. B Elaine -HFB- Ashton wrote: >Brian Volk [[EMAIL PROTECTED]] quoth: >*>Hi All, >*> >*>I'm trying to have perl get a file from my web hosting account. I >*>searched around and found Net::FTP::Common. I g

Re: Finding the date of last sunday

2002-03-21 Thread Peter Scott
At 07:30 AM 3/21/02 -0800, Randal L. Schwartz wrote: > > "Matt" == Matt C <[EMAIL PROTECTED]> writes: > >Matt> The Date::Manip module can do almost anything you can think of with >dates: >Matt> http://search.cpan.org/doc/SBECK/DateManip-5.40/Manip.pod > >Just beware of what I said last year i

Re: Help Required - Search and Replace

2002-03-21 Thread Jeff 'japhy' Pinyan
On Mar 21, Jonathan E. Paton said: >> I have a one big text file and also I have some >> set of strings to be replaced by another set of >> strings. Currently, I am reading each line of >> the file, and replacing one set of strings by >> another set of strings, one after another. Is >> there any

Re: Help Required - Search and Replace

2002-03-21 Thread Jonathan E. Paton
> I have a one big text file and also I have some > set of strings to be replaced by another set of > strings. Currently, I am reading each line of > the file, and replacing one set of strings by > another set of strings, one after another. Is > there any efficient way of doing this? The data > i

RE: Assigning chunks into variables - Please ignore previous email

2002-03-21 Thread Jeff 'japhy' Pinyan
On Mar 21, Ho, Tony said: >I managed to use the "split" and "join" functions to achieve what I wanted. You don't need join(), only split(). ($field, $value) = split /:/, $string, 2; Look into the third argument to split(). -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox

Re: Net::FTP::Common - get(RemoteFile => ?)

2002-03-21 Thread Elaine -HFB- Ashton
Brian Volk [[EMAIL PROTECTED]] quoth: *>Hi All, *> *>I'm trying to have perl get a file from my web hosting account. I *>searched around and found Net::FTP::Common. I get logged into my ftp *>account and can perform a "ls" but I get an error when I try to get a *>file. Here's the error: S

RE: newbie trying to zip files using archive::zip

2002-03-21 Thread Steven McCaffrey
Hi Tim: Thanks very much. You are a few days ahead of me. The only code I've seen at all is the documentation... Archive::Zip - Provide an interface to ZIP archive files. NAME Archive::Zip - Provide an interface to ZIP archive files. SYNOPSIS use Archive::Zip qw( :ERROR_CODES :CONSTANT

RE: Assigning chunks into variables - Please ignore previous email

2002-03-21 Thread Ho, Tony
Hi guys I managed to use the "split" and "join" functions to achieve what I wanted. Many thanks for those who started thinking about a possible approach. Tony -Original Message- From: Ho, Tony Sent: 21 March 2002 20:37 To: '[EMAIL PROTECTED]' Subject: Assigning chunks into variables H

Assigning chunks into variables

2002-03-21 Thread Ho, Tony
Hi guys I was wondering if you could help me. I have the following string: 2010:abc:def:ghi If I go through this string and find the first colon (:), I want to assign everything before that colon into variable1 I would like to assign the rest of the string after the first colon into variable

child processes not responding to HUP signal when parent running in BG

2002-03-21 Thread news reader
Hi, I have a script working as TCP socket server. It is forking child processes. These child processes are using system commands also. As some point of time, I need to kill all the processes running under main processes. and I am using following piece of code for that Which means to Hang up all

Re: Which is better?

2002-03-21 Thread Elaine -HFB- Ashton
Ken Cole [[EMAIL PROTECTED]] quoth: *> *>My question, in my experience NFS is not the quickest program around. *>Will it be faster to use say LWP or Net::ftp or similar to put and get *>the files in question than writing and reading from the NFS *>exported/mounted directory or shouldn't I worry?

RE: Regex peculiarity

2002-03-21 Thread David Gray
> 10,10,10,10 > nope.. \d+ matches the first digit \w+ matches the second > digit nothing for > \d* then , > > > try this: > /^(?:\d+[a-z]+\d*,?){4}$/ *ack* thanks :) \w matches alphaNUMERIC and _ Silly me. -dave -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-m

RE: Regex peculiarity

2002-03-21 Thread David Gray
> I'm not clear on what you're trying to match for. Is it: > Exactly one digit, followed by exactly any two characters, > followed by zero or more digits? One or more digits, followed by one or more characters, followed by zero or more digits, followed by zero or more commas, four times. (does

Re: Might be OT. Making a webpage.

2002-03-21 Thread Michael Kelly
On 3/21/02 5:36 AM, Tor Hildrum <[EMAIL PROTECTED]> wrote: >I want to make > my own Perl/CGI webpage. But, I don't really see any options in CGI.pm to > give the site the kind of design I want. Is there some place I could look > for information about the design options CGI.pm provides? I tried us

RE: Regex peculiarity

2002-03-21 Thread Nikola Janceski
10,10,10,10 nope.. \d+ matches the first digit \w+ matches the second digit nothing for \d* then , try this: /^(?:\d+[a-z]+\d*,?){4}$/ > -Original Message- > From: David Gray [mailto:[EMAIL PROTECTED]] > Sent: Thursday, March 21, 2002 3:58 PM > To: [EMAIL PROTECTED] > Subject: Regex pec

RE: Regex peculiarity

2002-03-21 Thread Crook, Richard W
I'm not clear on what you're trying to match for. Is it: Exactly one digit, followed by exactly any two characters, followed by zero or more digits? -Original Message- From: David Gray [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 21, 2002 12:58 PM To: [EMAIL PROTECTED] Subject: Regex

Regex peculiarity

2002-03-21 Thread David Gray
I'm matching a list of 4 measurments (i.e. 4pc,4pc,4pc,4pc) that all have to have some sort of unit specification (i.e. 4pc6,4in,4px,4pt) and I'm running into a bit of an oddity... If I use the regular expression: /^(?:\d+\w+\d*,?){4}$/ to match the above sequence, it matches the string '10,10,

Net::FTP::Common - get(RemoteFile => ?)

2002-03-21 Thread Brian Volk
Hi All, I'm trying to have perl get a file from my web hosting account. I searched around and found Net::FTP::Common. I get logged into my ftp account and can perform a "ls" but I get an error when I try to get a file. Here's the error: Net::FTP=GLOB(0x82fc210)<<< 230 User bvolk logged i

Re: precompile regular expressions?

2002-03-21 Thread Jenda Krynicky
From: Nikola Janceski <[EMAIL PROTECTED]> > Is there a way to precompile regular expressions? Look into perldoc perlop and search for qr/STRING/imosx $reSTRING = "\d+(?:\.\d+)?"; $re = qr/^$reSTRING$/; Jenda === [EMAIL PROTECTED] == http://Jenda.Krynicky.cz == There

RE: precompile regular expressions?

2002-03-21 Thread David Gray
Do you mean: my ($c,@compiled) = (); for(@accept) { $compiled[$c++] = qr/$_/; } ? then you can loop over @compiled instead of @accept, and it should be quite a bit faster. It sounds like that's what you're looking for. There is a big section on compiling regular expressions in O'Reilly Progra

Re: How to handle a currency sign in a calulation

2002-03-21 Thread Teresa Raymond
try: print "\$" . $value; >print $value; -- --- - Teresa Raymond - - Mariposa Net - - http://www.mariposanet.com - --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROT

RE: newbie trying to zip files using archive::zip

2002-03-21 Thread Timothy Johnson
Well, you didn't leave any code, but I'll give you what I just came up with (I just started using this module a few days ago). This is a script that gets all of the files in the c:\temp directory and puts them in a ZIP archive. Basically you want to add files as members using the addFile() meth

RE: How to handle a currency sign in a calulation

2002-03-21 Thread Timothy Johnson
Just escape the $ by prepending a backslash. \$ -Original Message- From: Bruce Ambraal [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 21, 2002 4:13 AM To: [EMAIL PROTECTED] Subject: How to handle a currency sign in a calulation The following programs calculates sum totals of the val

RE: precompile regular expressions?

2002-03-21 Thread Nikola Janceski
I know that, but I want it to change each time, but I was wondering if I can compile the regular expression before using it, since it's the same REs each time through the outer loop. I want it to test for either of the items in @accept (which is bigger in my program), but I don't want to waste ti

RE: precompile regular expressions?

2002-03-21 Thread Wagner-David
As part of regex use o like /$accept/o and this should compile only once vs each time through. Don't have all my books with me, but believe this will do it. Wags ;) -Original Message- From: Nikola Janceski [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 21, 2002 10:50 To: Begin

Re: Different Results on Different Boxes?

2002-03-21 Thread Jenda Krynicky
From: Michael Norris <[EMAIL PROTECTED]> > In my early (very early) stages of learning perl I've run into a > conflict. I have access to two linux machines that I practice on (I > do not have admin rights). The following is a simple script from > "Learning Perl." Problem is, it runs on one linu

Re: &function() or function()? and etiquette...

2002-03-21 Thread Jenda Krynicky
From: Nikola Janceski <[EMAIL PROTECTED]> > This question is more for the gurus. It's about etiquette and style. I > realize now the benefits of following coding standards and etiquette, > and of course use warnings and use strict. > > My question lies in the & when calling a subroutine. Should

Doing work on a file.. Spliting up the file

2002-03-21 Thread Steven M. Klass
Hi all, I am still trying to find a suitable way to split up a file. I have attached a sample file for your viewing pleasure. This file is a standard text file that I need to work on. Here is the basic idea of what I'm trying to do. 1. I ONLY want to work on the area from *DESCRIPTI

precompile regular expressions?

2002-03-21 Thread Nikola Janceski
Is there a way to precompile regular expressions? I have an array of acceptable matches, and an array of items to grep from. I want to avoid recompiling the regular expression over and over again, for each loop. ie. (imagine these lists are much longer). @stuff = ( "Micheal", "M

Re: Help Required - Search and Replace

2002-03-21 Thread Michael Stidham
my $new_file; open(FILE,') { $line=~s/WORD_TO_REPLACE/REPLACEMENT_WORD/g; $new_file.=$line; } close(FILE); open(FILE,'>new_file.txt') or die "Can't write new_file.txt: $!\n"; print FILE $new_file; close(FILE) I do something like this. Hope it helps >- Original Message - >From: "R

newbie trying to zip files using archive::zip

2002-03-21 Thread Steven McCaffrey
Hello: I am trying to combine text files into a single zip file. I've seen the documentation for archive::zip and think this is close to what I need but am still unsure how to use it. I want to take file1.txt file2.txt file3.txt ...and output fileall.zip Any user friendly help is apprecia

reading a file

2002-03-21 Thread sriram rachakonda
can anybody help me out on how to read in the text files say xyz.txt which is in a path /mnt/diskf/stu/tmp/sis into a hash ? anyone please **Sriram.R** **Sriram.R** _ Chat with friends online, try MSN Messenger: http://me

Different Results on Different Boxes?

2002-03-21 Thread Michael Norris
Hello, In my early (very early) stages of learning perl I've run into a conflict. I have access to two linux machines that I practice on (I do not have admin rights). The following is a simple script from "Learning Perl." Problem is, it runs on one linux box, but not the other. Here is th

Re: Finding the date of last sunday

2002-03-21 Thread Randal L. Schwartz
> "Matt" == Matt C <[EMAIL PROTECTED]> writes: Matt> The Date::Manip module can do almost anything you can think of with dates: Matt> http://search.cpan.org/doc/SBECK/DateManip-5.40/Manip.pod Just beware of what I said last year in comp.lang.perl.modules: > "Ilya" == Ilya Martynov <

&function() or function()? and etiquette...

2002-03-21 Thread Nikola Janceski
This question is more for the gurus. It's about etiquette and style. I realize now the benefits of following coding standards and etiquette, and of course use warnings and use strict. My question lies in the & when calling a subroutine. Should those who are starting out use &function(); or functi

Re: creating a hash

2002-03-21 Thread Tor Hildrum
On 21/3/02 15:49, "Trice Dennis D" <[EMAIL PROTECTED]> wrote: > I'm trying to create a hash of the /etc/group file. I need the key to be > the group name and just the members of the group to be the key value. > > Has anyone done this before? > I'm guessing you know how to grab a normal hash f

Re: creating a hash

2002-03-21 Thread Jeff 'japhy' Pinyan
On Mar 21, Trice Dennis D said: >I'm trying to create a hash of the /etc/group file. I need the key to be >the group name and just the members of the group to be the key value. You can use Perl's getgrent() function. setgrent(); while ( my ($name, $members) = (getgrent)[0,3] ) { $gro

RE: Making my own error.logs

2002-03-21 Thread Ron Goral
You can very easily create your own error logs. my $errLog = qq[logs/errorLog.log]; open(STDERR, ">>$errLog")?&LogEntry(\*STDERR,"Opened error log $errLog"):die ("Could not open $errLog. Reason: $!"); my $number = 10; $number eq 50?&LogEntry(\*STDERR,"$number equals 50."):&LogEntry(\*STDERR,"$num

creating a hash

2002-03-21 Thread Trice Dennis D
I'm trying to create a hash of the /etc/group file. I need the key to be the group name and just the members of the group to be the key value. Has anyone done this before? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: how to sort, in to out

2002-03-21 Thread David Gray
> >> I am trying to figure out an easy way to sort out a array > of numbers: > >> 2 20 38 56 75 93 -17 -35 -53 -72 -90 Into the following: > >> -90 -72 -53 -35 -17 2 20 38 56 75 93 > >> I have done the following: > >> @x_step = grep { ! $x_step_t{ $_ } ++ } @x_step_t; > >> @x_step = sort {

Re: how to sort, in to out

2002-03-21 Thread Tor Hildrum
On 21/3/02 15:04, "David Gray" <[EMAIL PROTECTED]> wrote: >> I am trying to figure out an easy way to sort out a array of numbers: >> 2 20 38 56 75 93 -17 -35 -53 -72 -90 >> Into the following: >> -90 -72 -53 -35 -17 2 20 38 56 75 93 >> I have done the following: >> @x_step = grep { ! $x_step_

RE: how to sort, in to out

2002-03-21 Thread Jenda Krynicky
From: "David Gray" <[EMAIL PROTECTED]> > > I am trying to figure out an easy way to sort out a array of > > numbers: 2 20 38 56 75 93 -17 -35 -53 -72 -90 Into the following: > > -90 -72 -53 -35 -17 2 20 38 56 75 93 I have done the following: > > @x_step = grep { ! $x_step_t{ $_ } ++ } @x_ste

Re: Which is better?

2002-03-21 Thread Adam Turoff
On Thu, Mar 21, 2002 at 10:54:18AM +1000, Ken Cole wrote: > I have an inherited web app that works like this. [...] > My question, in my experience NFS is not the quickest program around. > Will it be faster to use say LWP or Net::ftp or similar to put and get > the files in question than writin

RE: how to sort, in to out

2002-03-21 Thread David Gray
> I am trying to figure out an easy way to sort out a array of numbers: > 2 20 38 56 75 93 -17 -35 -53 -72 -90 > Into the following: > -90 -72 -53 -35 -17 2 20 38 56 75 93 > I have done the following: > @x_step = grep { ! $x_step_t{ $_ } ++ } @x_step_t; > @x_step = sort {$a == $b} @x_step;

Might be OT. Making a webpage.

2002-03-21 Thread Tor Hildrum
I just recently got a project to put up a webpage that had a registration form, saved all registrations and emailed out information to the people who registered and made reports on who had registered and emailed those reports. I had a lot of fun while doing it(and learned a lot), so now I want to

RE: perl infant stage..

2002-03-21 Thread Jason Larson
> -Original Message- > From: Perl CosmicVoid [mailto:[EMAIL PROTECTED]] > Subject: RE: perl infant stage.. > > Hi! > > Ive got two different Perl icons now. > One Big Perl and another a small perl against a paper > backdrop.. > > the MSDOS program does run, However its a split second >

Re: how to sort, in to out

2002-03-21 Thread Jenda Krynicky
From: Jerry Preston <[EMAIL PROTECTED]> > I am trying to figure out an easy way to sort out a array of numbers: > > 2 20 38 56 75 93 -17 -35 -53 -72 -90 > > Into the following: > > -90 -72 -53 -35 -17 2 20 38 56 75 93 > > I have done the following: > > @x_step = grep { !

Re: Help Required - Search and Replace

2002-03-21 Thread Patrice Boisieau
Try this algorithm : Read the file (if you have sufficient memory to load it) Replace in each ligne Write the new lines P. Boisieau >From: Rajanikanth Dandamudi <[EMAIL PROTECTED]> >To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]> >Subject: Help Required - Search and Replace >Date: Thu, 21 Mar 20

Re: GD getBounds problem

2002-03-21 Thread zentara
On Wed, 20 Mar 2002 12:18:28 -0800, [EMAIL PROTECTED] (Agustin Rivera) wrote: >I have a problem. The code below creates the error below. I can't see what >is wrong with it. I could of swore this code used to work. >Any ideas? > >use GD; >use LWP::Simple; >use strict; >### GET IMAGE ATTRIBS ><.

Re: Help Required - Search and Replace

2002-03-21 Thread Patrice Boisieau
Try this algorithm : >From: Rajanikanth Dandamudi <[EMAIL PROTECTED]> >To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]> >Subject: Help Required - Search and Replace >Date: Thu, 21 Mar 2002 10:55:41 +0530 > >All, > >I have a one big text file and also I have some set of strings to be >replaced by

Re: Help Required - Search and Replace

2002-03-21 Thread Patrice Boisieau
Try this algorithm : >From: Rajanikanth Dandamudi <[EMAIL PROTECTED]> >To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]> >Subject: Help Required - Search and Replace >Date: Thu, 21 Mar 2002 10:55:41 +0530 > >All, > >I have a one big text file and also I have some set of strings to be >replaced by

How to handle a currency sign in a calulation

2002-03-21 Thread Bruce Ambraal
The following programs calculates sum totals of the values in file (Values.dat). Values.dat: --- $30,45 $0,50 How do I handle the $ sign infront of the values. I want the $ sign in the result when calulating sum of these values. In my program I left out the $ sign cause I dont kno

how to sort, in to out

2002-03-21 Thread Jerry Preston
Hi, I am trying to figure out an easy way to sort out a array of numbers: 2 20 38 56 75 93 -17 -35 -53 -72 -90 Into the following: -90 -72 -53 -35 -17 2 20 38 56 75 93 I have done the following: @x_step = grep { ! $x_step_t{ $_ } ++ } @x_step_t; @x_step = sort {$a == $b} @x_step; To

RE: splitting the string.

2002-03-21 Thread Nisim, Amit
just do $a ="abcdef"; @asplit = split //,$a; Amit -Original Message- From: Raja Gopal [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 21, 2002 8:41 AM To: [EMAIL PROTECTED] Subject: splitting the string. Hello Perl Experts, I want to split the string $a ="abcdef"; as @asplit =

RE: splitting the string.

2002-03-21 Thread Veeraraju_Mareddi
$a ='abcdef'; @arr = split(//,$a); print "@arr"; > -- > From: Raja Gopal[SMTP:[EMAIL PROTECTED]] > Sent: Thursday, March 21, 2002 12:11 PM > To: [EMAIL PROTECTED] > Subject: splitting the string. > > Hello Perl Experts, > > I want to split the string $a ="abcde

Fuzzy Matching

2002-03-21 Thread paul beckett (JIC)
I am attempting to do a "fuzzy match" with the String::Approx (v.3) module, with very limited success. I am working with biological genome sequence, this is a 30136242 character long string (which I load into $seq), each character is either an A , T , G or C (or in some cases more rarely an N to d

Re: Finding the date of last sunday

2002-03-21 Thread John W. Krahn
Rory Oconnor wrote: > > Can anyone think of a good way for me to find out what the date of last > sunday is with perl? I'm writing a script that will need to do some > basic reporting starting from the previous sunday. > > I'm usign the date format -MM-DD $ perl -le'use Time::Local; ( $yea

splitting the string.

2002-03-21 Thread Raja Gopal
Hello Perl Experts, I want to split the string $a ="abcdef"; as @asplit = ("a","b","c","d","e","f"). Is this possible. Kindly provide your valuable inputs. Thank you very much. Regards, Rajagopal __ Do You Yahoo!? Yahoo! Movies - coverag

Which is better?

2002-03-21 Thread Ken Cole
Hi, I have an inherited web app that works like this. Machine A, Sco Unix, NFS exported directory, only internal IP address Machine B, RH Linux, mounted NFS directory from Machine A, two IP's internal & external, apache, perl, etc The web app, runs a perl script which, creates some files in the