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($_ =~
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
$. 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
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++;
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:
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
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
> >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
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
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
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
> 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
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
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
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
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
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
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
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?
> 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
> 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
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
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
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
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,
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
> "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 <
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
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
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
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
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]
> >> 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 {
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_
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
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
> 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;
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
> -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
>
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 { !
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
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
><.
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
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
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
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
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 =
$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
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
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
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
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
67 matches
Mail list logo