XML to inMemory Hash

2007-07-31 Thread Prabu Ayyappan
Hi, I want to convert a huge XML file into an inMemory Hash. I tried using XML::Simple. But its taking huge memory space and time to convert it into Hash. While loading a XML file of 300MB its taking more memory space and time. Is there any better method to load this XML t

Re: A simple program

2007-07-31 Thread Chas Owens
On 7/31/07, Jeff Pang <[EMAIL PROTECTED]> wrote: > > --- Chas Owens <[EMAIL PROTECTED]> wrote: > > > > oops, the map should be > > > > print map { join(",", ($_) x $i++),"\n" } @a; > > > > Also using for loop is may better since many ppl on > this list said map would consume too much memory if > th

Re: A simple program

2007-07-31 Thread Jeff Pang
--- Chas Owens <[EMAIL PROTECTED]> wrote: > > oops, the map should be > > print map { join(",", ($_) x $i++),"\n" } @a; > Also using for loop is may better since many ppl on this list said map would consume too much memory if the input array is large enough. print join(",", ($_) x ++$i),"\n"

Re: A simple program

2007-07-31 Thread Chas Owens
On 7/31/07, Chas Owens <[EMAIL PROTECTED]> wrote: snip > print join(",", ($arrow[2]) x 3), "\n"; > > which is the same as > > print join(",", $arrow[2], $arrow[2], $arrow[2]), "\n"; snip It is important to note that print join(",", (time()) x 3), "\n"; is not the same as print join(",", time(),

Re: A simple program

2007-07-31 Thread Chas Owens
On 7/31/07, Rodrigo Tavares <[EMAIL PROTECTED]> wrote: > Hello John, > > You could explain the below line ? > > print join( ',', ( $arrow[ $_ ] ) x ( $_ + 1 ) ), > "\n"; snip x is the repetition operator. When the left side is a scalar it builds a string that contains the left side repeated the

Re: A simple program

2007-07-31 Thread Rodrigo Tavares
Hello John, You could explain the below line ? print join( ',', ( $arrow[ $_ ] ) x ( $_ + 1 ) ), "\n"; Thanks, Rodrigo Faria --- "John W. Krahn" <[EMAIL PROTECTED]> escreveu: > Chas Owens wrote: > > On 7/31/07, John W. Krahn <[EMAIL PROTECTED]> > wrote: > > snip > >> Or more simply as: > >>

Re: A simple program

2007-07-31 Thread Chas Owens
On 7/31/07, John W. Krahn <[EMAIL PROTECTED]> wrote: snip > > my @a = =~ /^(\d)(\d)?(\d)?(\d)?(\d)?$/g > > You are using the /g option but the pattern is anchored at the beginning and > ending of the line so it will only match once making the /g option > superfluous. (Even if you added the /m opt

Re: A simple program

2007-07-31 Thread Rodrigo Tavares
Hello John, I don't understood the line in loop for the # in variable arrow. How It can to be used ? Best regards, Rodrigo --- "John W. Krahn" <[EMAIL PROTECTED]> escreveu: > Rodrigo Tavares wrote: > > Hello, > > Hello, > > > I got make a script, see below : > > > > #!/usr/bin/perl > >

Re: A simple program

2007-07-31 Thread John W. Krahn
Chas Owens wrote: On 7/31/07, John W. Krahn <[EMAIL PROTECTED]> wrote: snip Or more simply as: #!/usr/bin/perl use strict; use warnings; print 'Enter 5 digits: '; ( my @arrow = =~ /\d/g ) == 5 or die "Only five digits !\n"; for ( 0 .. $#arrow ) { print join( ',', ( $arrow[ $_ ] ) x ( $

Re: from Perl Cookbook - what is single quote in brackets

2007-07-31 Thread Nevada
So the single quote means single quote. Thanks, Chas. I thought it might have had some special meaning. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: missing values from files

2007-07-31 Thread John W. Krahn
Irenta wrote: ok it started working and now that I run it in another computer is doing the same thing. I added -w at the top and it is giving me the following errors: -w will give you warnings not errors. Use of uninitialized value in division (/) at ./filegroupfix1_1000.txt line 133, line

Re: A simple program

2007-07-31 Thread Chas Owens
On 7/31/07, Chas Owens <[EMAIL PROTECTED]> wrote: > On 7/31/07, John W. Krahn <[EMAIL PROTECTED]> wrote: > snip > > Or more simply as: > > > > #!/usr/bin/perl > > > > use strict; > > use warnings; > > > > print 'Enter 5 digits: '; > > ( my @arrow = =~ /\d/g ) == 5 or die "Only five digits !\n"; >

Re: A simple program

2007-07-31 Thread Chas Owens
On 7/31/07, John W. Krahn <[EMAIL PROTECTED]> wrote: snip > Or more simply as: > > #!/usr/bin/perl > > use strict; > use warnings; > > print 'Enter 5 digits: '; > ( my @arrow = =~ /\d/g ) == 5 or die "Only five digits !\n"; > > for ( 0 .. $#arrow ) { > print join( ',', ( $arrow[ $_ ] ) x ( $_

Re: A simple program

2007-07-31 Thread John W. Krahn
Rodrigo Tavares wrote: Hello, Hello, I got make a script, see below : #!/usr/bin/perl use strict; use warnings; print "Enter 5 digits: "; my $digit = ; my $cont = length($digit) - 1; if ($cont > 5) { print "Only five digits ! \n" } else { my @arrow = split(//, $digit);

Re: A simple program

2007-07-31 Thread Rodrigo Tavares
Hello, I got make a script, see below : #!/usr/bin/perl use strict; use warnings; print "Enter 5 digits: "; my $digit = ; my $cont = length($digit) - 1; if ($cont > 5) { print "Only five digits ! \n" } else { my @arrow = split(//, $digit); print "$arrow[0]\n"; print "

Re: missing values from files

2007-07-31 Thread Irenta
On Jul 30, 3:27 pm, [EMAIL PROTECTED] (Rob Dixon) wrote: > Chas Owens wrote: > > On 7/30/07, John W. Krahn <[EMAIL PROTECTED]> wrote: > >> Chas Owens wrote: > >>> On 7/30/07, Isha M. Renta <[EMAIL PROTECTED]> wrote: > The 13 is the counter for the $inittime array (which actually have 13 >

Re: from Perl Cookbook - what is single quote in brackets

2007-07-31 Thread Chas Owens
On 7/31/07, Chas Owens <[EMAIL PROTECTED]> wrote: > On 7/31/07, Nevada <[EMAIL PROTECTED]> wrote: > snip > > but what is [\pL']? > snip > > Oops, I misread the question. It matches a unicode letter or a single quote. > from perldoc perlre You can specify a character class, by enclosing a l

Re: from Perl Cookbook - what is single quote in brackets

2007-07-31 Thread Chas Owens
On 7/31/07, Nevada <[EMAIL PROTECTED]> wrote: snip > but what is [\pL']? snip Oops, I misread the question. It matches a unicode letter or a single quote. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: from Perl Cookbook - what is single quote in brackets

2007-07-31 Thread Chas Owens
On 7/31/07, Nevada <[EMAIL PROTECTED]> wrote: > Hello, > > In the Perl Cookbook recipe 1.14 - "Properly Capitalizing a Title or > Headline" I see this substitution: > >s/(\pL[\pL']*)/$nocap{$1} ? lc($1) : ucfirst(lc($1))/ge; > > if a word appears in the nocap hash, it is made lower case. the \p

from Perl Cookbook - what is single quote in brackets

2007-07-31 Thread Nevada
Hello, In the Perl Cookbook recipe 1.14 - "Properly Capitalizing a Title or Headline" I see this substitution: s/(\pL[\pL']*)/$nocap{$1} ? lc($1) : ucfirst(lc($1))/ge; if a word appears in the nocap hash, it is made lower case. the \pL matches a lower case character but what is [\pL']? Thank

Re: **Installing CGI.pm

2007-07-31 Thread Adriano Ferreira
On 7/31/07, Johnson, Reginald (GTI) <[EMAIL PROTECTED]> wrote: > On Jul 31, 1:31 pm, [EMAIL PROTECTED] (Jackson Samson) wrote: > > I have downloaded the CGI.pm to my Windows machine. Do I need a C > > compiler to build this or can I use ppm install CGI.pm? > > Neither. CGI is a core Perl module.

Re: **Installing CGI.pm

2007-07-31 Thread Paul Lalli
On Jul 31, 2:52 pm, [EMAIL PROTECTED] (Reginald Johnson) wrote: > How would one find out what the other core perl modules are? Run this command at a console window: perldoc perlmodlib Paul Lalli -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ht

Re: **Installing CGI.pm

2007-07-31 Thread Mr. Shawn H. Corey
Paul Lalli wrote: On Jul 31, 1:31 pm, [EMAIL PROTECTED] (Jackson Samson) wrote: I have downloaded the CGI.pm to my Windows machine. Do I need a C compiler to build this or can I use ppm install CGI.pm? Neither. CGI is a core Perl module. Nothing external needs to be installed. You had no

RE: **Installing CGI.pm

2007-07-31 Thread Johnson, Reginald (GTI)
On Jul 31, 1:31 pm, [EMAIL PROTECTED] (Jackson Samson) wrote: > I have downloaded the CGI.pm to my Windows machine. Do I need a C > compiler to build this or can I use ppm install CGI.pm? Neither. CGI is a core Perl module. Nothing external needs to be installed. You had no reason to downloa

Re: parsing a log file by date

2007-07-31 Thread Paul Lalli
On Jul 31, 12:36 pm, [EMAIL PROTECTED] (Chas Owens) wrote: > On 7/31/07, jeevs <[EMAIL PROTECTED]> wrote: > > 2007-08-09,0,0,0,0,0,0 > > 2007-08-11,0,0,0,0,0,1 > > 2007-08-11,0,0,0,0,0,1 > > 2007-08-12,0,0,0,2,3,2 > Use timelocal* or mktime** to convert the dates to the integer number > of seconds

Re: **Installing CGI.pm

2007-07-31 Thread Paul Lalli
On Jul 31, 1:31 pm, [EMAIL PROTECTED] (Jackson Samson) wrote: > I have downloaded the CGI.pm to my Windows machine. Do I need a C > compiler to build this or can I use ppm install CGI.pm? Neither. CGI is a core Perl module. Nothing external needs to be installed. You had no reason to downloa

**Installing CGI.pm

2007-07-31 Thread jackson_samson
Hi All, I have downloaded the CGI.pm to my Windows machine. Do I need a C compiler to build this or can I use ppm install CGI.pm? I tried to do that and I get the following error: Can't find any package that provide CGI.pm Does anyone know if and where I can just download an already compiled C

Re: define an array in perl

2007-07-31 Thread Paul Lalli
On Jul 31, 6:59 am, [EMAIL PROTECTED] (Jeniffer) wrote: > sorry for the stupid question,,,please help me out What was wrong with the answers you got when you asked the same question in comp.lang.perl.misc? http://groups.google.com/group/comp.lang.perl.misc/browse_frm/thread/163983d0954e06af/

Re: define an array in perl

2007-07-31 Thread Chas Owens
On 7/31/07, jeniffer <[EMAIL PROTECTED]> wrote: > Hi > I am a newbie in perl. I have an array block_list : > > push ( @block_list ,$word); # this word is read from a file. > $list_name = $block_list[$#block_list]; # i extract the last element > ie $word in this case > now i want to define an arra

define an array in perl

2007-07-31 Thread jeniffer
Hi I am a newbie in perl. I have an array block_list : push ( @block_list ,$word); # this word is read from a file. $list_name = $block_list[$#block_list]; # i extract the last element ie $word in this case now i want to define an array with the name $list_name like , my @"$list_name"; But th

parsing a log file by date

2007-07-31 Thread jeevs
Hello forum. I am here with a logical problem rather. I have a log file which will be huge in and can run in MBs. log file structure is like 2007-08-09,0,0,0,0,0,0 2007-08-11,0,0,0,0,0,1 2007-08-11,0,0,0,0,0,1 2007-08-12,0,0,0,2,3,2 What I am supposed to do is show the data between particular da

Re: parsing a log file by date

2007-07-31 Thread Chas Owens
On 7/31/07, jeevs <[EMAIL PROTECTED]> wrote: > Hello forum. > > I am here with a logical problem rather. I have a log file which will > be huge in and can run in MBs. > log file structure is like > > 2007-08-09,0,0,0,0,0,0 > 2007-08-11,0,0,0,0,0,1 > 2007-08-11,0,0,0,0,0,1 > 2007-08-12,0,0,0,2,3,2 >

Re: parsing a log file by date

2007-07-31 Thread Mr. Shawn H. Corey
jeevs wrote: Hello forum. I am here with a logical problem rather. I have a log file which will be huge in and can run in MBs. log file structure is like 2007-08-09,0,0,0,0,0,0 2007-08-11,0,0,0,0,0,1 2007-08-11,0,0,0,0,0,1 2007-08-12,0,0,0,2,3,2 What I am supposed to do is show the data betwee

Re: How to check integrity of a webpage from perl

2007-07-31 Thread skywriter14
A leaf from history: (I like "talks", old or new) Found in: http://www.modperl.com/perl_conference/cool_tricks/handout.html Author: Lincoln Stein Date: 3/15/99 Monitoring a remote server Local monitoring won't catch problems with remote machines, and they'll miss subtle problems that can happen w

Re: String Manipulation

2007-07-31 Thread Dharshana Eswaran
Thanks Everyone for your suggestions. It really helped. I shall freshen up from the documents suggested to me. But anyways, i would like to say, that unless any one works on any language, mastering it is difficult. When i go through the tutorials or documents, i seem to know. But practically, onl

RE: String Manipulation

2007-07-31 Thread Andrew Curry
But in this case it was also not needed as I replied without actually reading the requirements. -Original Message- From: Paul Lalli [mailto:[EMAIL PROTECTED] Sent: 31 July 2007 14:21 To: beginners@perl.org Subject: Re: String Manipulation On Jul 31, 8:40 am, [EMAIL PROTECTED] (Dharshana

Re: String Manipulation

2007-07-31 Thread Paul Lalli
On Jul 31, 8:40 am, [EMAIL PROTECTED] (Dharshana Eswaran) wrote: > And your suggestion worked. Thank you. But in the string which u had > suggested, [,\s*\/*]?, here \s* => tells spaces are optional, No it doesn't. The "dirty dozen" characters lose their special meaning inside of a character clas

Re: String Manipulation

2007-07-31 Thread Dharshana Eswaran
Oops!!! Sorry, It is ([A-Z0-9_]+). It was a typo in my mail. And your suggestion worked. Thank you. But in the string which u had suggested, [,\s*\/*]?, here \s* => tells spaces are optional, /\* sells the beginning of the comment, I am unable to understand what these in a square bracket along wit

Re: String Manipulation

2007-07-31 Thread Rob Dixon
Dharshana Eswaran wrote: I have a string which reads $str5 = "DL_FEM_ADJ1 = DL_FEM_LINE_FIRST, /* Keep the adjacent ones consecutive */"; Here i need to consider the variable and its value, ignoring the comment. I have a pattern which reads if($str5 =~ /\s*([A-Z_]+)\s=\s(\w+),*/) { pr

RE: String Manipulation

2007-07-31 Thread Andrew Curry
Try if($str5 =~ /\s*(\S+)\s*=\s*(\S+)[,\s*\/*]?/) I cant see how your ([A-Z_]+) Will match your DL_FEM_ADJ1 as this has a number on it? -Original Message- From: Dharshana Eswaran [mailto:[EMAIL PROTECTED] Sent: 31 July 2007 13:17 To: Perl Beginners Subject: String Manipulation Hi

String Manipulation

2007-07-31 Thread Dharshana Eswaran
Hi All, I have a string which reads $str5 = "DL_FEM_ADJ1 = DL_FEM_LINE_FIRST, /* Keep the adjacent ones consecutive */"; Here i need to consider the variable and its value, ignoring the comment. I have a pattern which reads if($str5 =~ /\s*([A-Z_]+)\s=\s(\w+),*/) { print "$1 and $2\n";

Re: FW: Html within code

2007-07-31 Thread Mr. Shawn H. Corey
Rob Dixon wrote: When someone is trying very hard to learn to write Perl that works at all, I think it is /not/ the time to regale him with the rigours of professional programming. Rob Programming is a rigorous discipline. Learning to do things right the first time around achieves two thing

Re: Light at the end of Module Prerequisite Tunnel?

2007-07-31 Thread yaron
Hi Jerry, Most of the perl distribution comes with cpan. If you don't have cpan by default (say you work with active perl), I suggest you work with distribution that supplies cpan. If you work on windows I reccomend to work with cygwin (http://www.cygwin.com/). Best regards, Yaron Kahanovitch -