Re:out of memory

2008-10-31 Thread Jeff Pang
> Message du 31/10/08 17:42 > De : "[EMAIL PROTECTED]" > A : beginners@perl.org > Copie à : > Objet : out of memory > > > > In above code $file is very big in size(in Gbs); so I am getting out > of memory ! > > You may want to use Tie::Hash, or some DBs like MLDBM (http://search.cpan.org/~chama

Re: Why is my regex so slow?

2008-10-31 Thread Jenda Krynicky
From: "Mark Wagner" <[EMAIL PROTECTED]> > I've got a script I'm using to search through a list of Wikipedia > article titles to find ones that match certain patterns. > > As-written, if you run it and supply '.*target.*' on standard input, > it will process my test file in 125 seconds. Make any o

Re: Why is my regex so slow?

2008-10-31 Thread John W. Krahn
Mark Wagner wrote: I've got a script I'm using to search through a list of Wikipedia article titles to find ones that match certain patterns. As-written, if you run it and supply '.*target.*' on standard input, it will process my test file in 125 seconds. '.*target.*' is inefficient because th

Re: Why is my regex so slow?

2008-10-31 Thread Mark Wagner
I probably should have specified: the program in my first email is a minimal sample that can reproduce the problem. The original program is significantly longer and more complex. On Fri, Oct 31, 2008 at 14:38, Li, Jialin <[EMAIL PROTECTED]> wrote: > > print "Match\n" if($target =~ /^$regex$/o);

Re: Why is my regex so slow?

2008-10-31 Thread Li, Jialin
On Fri, Oct 31, 2008 at 2:54 PM, Mark Wagner <[EMAIL PROTECTED]> wrote: > I've got a script I'm using to search through a list of Wikipedia > article titles to find ones that match certain patterns. > > As-written, if you run it and supply '.*target.*' on standard input, > it will process my test

Re: Why is my regex so slow?

2008-10-31 Thread Li, Jialin
try this: print "Match\n" if($target =~ /^$regex$/*o*); only compile regex only once On Fri, Oct 31, 2008 at 2:54 PM, Mark Wagner <[EMAIL PROTECTED]> wrote: > I've got a script I'm using to search through a list of Wikipedia > article titles to find ones that match certain patterns. > > As-

Re: signal processing INT or TERM

2008-10-31 Thread Mark Wagner
On Wed, Oct 29, 2008 at 13:50, icarus <[EMAIL PROTECTED]> wrote: > perl 5.8.2 > OS: AIX fully POSIX compliant > > my script moves files from one dir to another. > When I want my script to stop, should I pass it along the signal INT > or TERM? > > INT just interrupts the script. It finishes whateve

Why is my regex so slow?

2008-10-31 Thread Mark Wagner
I've got a script I'm using to search through a list of Wikipedia article titles to find ones that match certain patterns. As-written, if you run it and supply '.*target.*' on standard input, it will process my test file in 125 seconds. Make any of the changes mentioned in the comments, and the t

merge 2 or more files together without creating new file

2008-10-31 Thread slow_leaner
Hi, Is there a way I can marge FILE2 into FILE1 or reverse together without creating a new merge file. I am not sure there are a better way to do it. If you give me some hint or help, i would appreciate it. thx. Here is my code. #!/bin/usr/perl open(FILE1, /usr/test1.txt); @temp =; close (FILE1);

Re: merge 2 or more files together without creating new file

2008-10-31 Thread Mr. Shawn H. Corey
On Fri, 2008-10-31 at 10:27 -0700, slow_leaner wrote: > Hi, > Is there a way I can marge FILE2 into FILE1 or reverse together > without creating a new merge file. I am not sure there are a better > way to do it. If you give me some hint or help, i would appreciate > it. > thx. > Here is my code. >

Re: Why doesn't this work: perl -e "@s=([1,2],[3,4]); print $s[0][0];"

2008-10-31 Thread John W. Krahn
Zembower, Kevin wrote: (This should probably be an easy one for someone.} Why doesn't this work: [EMAIL PROTECTED]:/usr/local/src/rrd$ perl -e "@s=(["a","b"],["c","d"]);print $s[0][0];" syntax error at -e line 1, near "][" Execution of -e aborted due to compilation errors. The shell interpola

RE: Why doesn't this work: perl -e "@s=([1,2],[3,4]); print $s[0][0];"

2008-10-31 Thread Zembower, Kevin
Oh, it was that simple. Thanks so much, Paul. -Kevin -Original Message- From: Paul Johnson [mailto:[EMAIL PROTECTED] Sent: Friday, October 31, 2008 1:42 PM To: Zembower, Kevin Cc: 'beginners@perl.org' Subject: Re: Why doesn't this work: perl -e "@s=([1,2],[3,4]); print $s[0][0];" On Fri,

Re: Why doesn't this work: perl -e "@s=([1,2],[3,4]); print $s[0][0];"

2008-10-31 Thread Paul Johnson
On Fri, Oct 31, 2008 at 01:34:05PM -0400, Zembower, Kevin wrote: > (This should probably be an easy one for someone.} > > Why doesn't this work: > [EMAIL PROTECTED]:/usr/local/src/rrd$ perl -e "@s=(["a","b"],["c","d"]);print > $s[0][0];" > syntax error at -e line 1, near "][" > Execution of -e ab

Why doesn't this work: perl -e "@s=([1,2],[3,4]); print $s[0][0];"

2008-10-31 Thread Zembower, Kevin
(This should probably be an easy one for someone.} Why doesn't this work: [EMAIL PROTECTED]:/usr/local/src/rrd$ perl -e "@s=(["a","b"],["c","d"]);print $s[0][0];" syntax error at -e line 1, near "][" Execution of -e aborted due to compilation errors. [EMAIL PROTECTED]:/usr/local/src/rrd$ perl -e

out of memory

2008-10-31 Thread [EMAIL PROTECTED]
Hi, I want to parse large log file (in GBs) and I am readin 2-3 such files in hash array. But since it will very big hash array it is going out of memory. what are the other approach I can take. Example code: open ($INFO, '<', $file) or die "Cannot open $file :$!\n"; while (<$INFO>) {

Re: Issue with references and array slice with one member !

2008-10-31 Thread Chas. Owens
On Fri, Oct 31, 2008 at 05:46, Amit Saxena <[EMAIL PROTECTED]> wrote: snip > I used "${$row}[0]", "${$row}[1]" etc one by one to get all the columns for > a particular code. On one of the production code which I am working, they > have used "@{$row}[0]" , "@{$row}[0]" instead of earlier. The result

RE: How to put a global variable in a package, accessible to users of that package?

2008-10-31 Thread Stewart Anderson
> -Original Message- > From: Rob Dixon [mailto:[EMAIL PROTECTED] > Sent: 31 October 2008 11:51 > To: Perl Beginners > Cc: Stewart Anderson > Subject: Re: How to put a global variable in a package, accessible to > users of that package? > > Stewart Anderson wrote: > >> From: mrstevegross [m

Re: How to put a global variable in a package, accessible to users of that package?

2008-10-31 Thread Rob Dixon
Stewart Anderson wrote: >> From: mrstevegross [mailto:[EMAIL PROTECTED] >> >> I have a package named "Foo" in which I want to define some package- >> level constants (such as $VAR="soemval"). I want those constants >> available to users of package Foo, so the following code would work: >> >> === fo

RE: How to put a global variable in a package, accessible to users of that package?

2008-10-31 Thread Stewart Anderson
> -Original Message- > From: Jeff Pang [mailto:[EMAIL PROTECTED] > Sent: 31 October 2008 09:38 > To: Perl Beginners [Beginners Perl] > Subject: RE: How to put a global variable in a package, accessible to > users of that package? > > > > Message du 31/10/08 10:25 > > De : "Stewart Anders

Issue with references and array slice with one member !

2008-10-31 Thread Amit Saxena
Hello all, Recently I faced one scenario with references and array slice in perl. I used following program to retrieve the rows from a table in Oracle using Perl DBI. As shown in the program, I did following steps to retrieve the rows :- - used "fetchall_arrayref" to get the array reference

RE: How to put a global variable in a package, accessible to users of that package?

2008-10-31 Thread Jeff Pang
> Message du 31/10/08 10:25 > De : "Stewart Anderson" > A : "mrstevegross" , beginners@perl.org > > === foo.pl === > > package foo; > > use constant VAR => "someval"; > > > > === bar.pl === > > use foo; > > print $foo::VAR; > > > > It doesn't appear to be working; it compiles ok, but it prints >

RE: How to put a global variable in a package, accessible to users of that package?

2008-10-31 Thread Stewart Anderson
> From: mrstevegross [mailto:[EMAIL PROTECTED] > Sent: 30 October 2008 18:43 > To: beginners@perl.org > Subject: How to put a global variable in a package, accessible to users of > that package? > > I have a package named "Foo" in which I want to define some package- > level constants (such as $VA