Re: Errors on processing 2GB XML file by using XML:Simple

2005-05-17 Thread Nan Jiang
Hi Peter, Your codes look great and it works perfectly with only some minor problems which might due to the XML file itself (I think). However, compared your codes with mine, there are something I'd like to ask you if you don't mind. 1) what's the main difference on memory load bewteen setting h

Re: Errors on processing 2GB XML file by using XML:Simple

2005-05-17 Thread Peter Rabbitson
> Your codes look great and it works perfectly with only some minor problems > which might due to the XML file itself (I think). However, compared your > codes with mine, there are something I'd like to ask you if you don't mind. Not that much :) > 1) what's the main difference on memory load b

A very general question to perl experts

2005-05-17 Thread Madhur Kashyap
Hello Perl Experts, I am facing a problem day-in and day-out with my perl code. There are a couple of subroutines in it. Below I am writing the stub-form of my perl code. === #!/usr/local/bin/perl #Some comments ... use strict; use

Problem with DBD-Pg

2005-05-17 Thread mike
Since upgrading to FC4-test3 which has version 1.4.1 of DBD-Pg installed, placeholders no longer work for example the following code $cat='1'; #$cat=param('Category'); print $cat; print start_multipart_form (POST,'con_upd.pl'); $row=$dbh->prepare("SELECT type_code FROM lk_sort_of_contact WHERE de

is there be better way to write regex for

2005-05-17 Thread Manish Sapariya
Hi List, I have following regex: echo "1: 192.168.0.180:32866 - 192.168.0.183:143 (a2b) 17> 14< (complete)" | perl -lane 'print$_;if($_ =~ /(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}):(\d{1,5}) - (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}):(\d{1,5})/) {print "Source IP = $1, Source Port = $2, Destinati

Re: is there be better way to write regex for

2005-05-17 Thread Ing. Branislav Gerzo
Manish Sapariya [MS], on Tuesday, May 17, 2005 at 17:38 (+0530) has on mind: MS> echo "1: 192.168.0.180:32866 - 192.168.0.183:143 (a2b) MS> 17> 14< (complete)" | perl -lane 'print$_;if($_ =~ MS> /(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}):(\d{1,5}) - MS> (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}):(\d{1,5

Re: Compare to multiple numbers

2005-05-17 Thread Zeus Odin
"Christopher L Hood" <[EMAIL PROTECTED]> wrote ... > Why doesn't this work to check the until it is one of the numbers > "1 2 3 4 5" ?? I have tried multiple variations of this with different > brackets ie. [ ] , and ( ) . Chris, this doesn't work because you didn't write valid code. ;-) I thin

have a problem with socket

2005-05-17 Thread Manuel Sanguino
this is my script #!/usr/bin/perl -w use lib "/my/perl_directory/lib/perl5/site_perl/5.8.3/"; use IO::Socket::INET6; $host="150.187.25.206"; my $dat1; my @arreglo; my @arreglo2; my $dat2; my $dat3; my $dato; my $count; my $volt1; $remote = IO::Socket::INET6->new( Proto => "tcp",

Re: A very general question to perl experts

2005-05-17 Thread Dave Gray
> sub readDefectData { > my $defectDataFH=new FileHandle; > open ($defectDataFH,$_[0]) or die "Error: Cannot load defectivity > data, $_[0]\n"; > print "Loading defect data ... "; > my %short; > while ($_=$defectDataFH->getline) { > chomp; >

print adds spaces (was: have a problem with socket)

2005-05-17 Thread Wiggins d'Anconia
Manuel Sanguino wrote: > this is my script > > #!/usr/bin/perl -w > > > use lib "/my/perl_directory/lib/perl5/site_perl/5.8.3/"; > use IO::Socket::INET6; > $host="150.187.25.206"; > my $dat1; > my @arreglo; > my @arreglo2; > my $dat2; > my $dat3; > my $dato; > my $count; > my $volt1; > $remote =

Determine structure size

2005-05-17 Thread Peter Rabbitson
Is there a way to determine how much a certain data structure costs in terms of memory? In other words is there some built in command or module that takes a reference to a nested data structure and gives a ball park idea of how much memory this structure takes. Thanks Peter -- To unsubscribe

Re: Determine structure size

2005-05-17 Thread John Doe
Am Dienstag, 17. Mai 2005 19.45 schrieb Peter Rabbitson: > Is there a way to determine how much a certain data structure costs in > terms of memory? In other words is there some built in command or module > that takes a reference to a nested data structure and gives a ball park > idea of how much m

Re: Determine structure size

2005-05-17 Thread Dave Gray
> Is there a way to determine how much a certain data structure costs in terms > of memory? In other words is there some built in command or module that > takes a reference to a nested data structure and gives a ball park idea of > how much memory this structure takes.

a print problem.

2005-05-17 Thread Zhenhai Duan
Hi, I have a simple code but I just cannot get the correct result. Can anyone take a look at the code for me? Many thanks. print "\nOutput: AS -- Subnets\n"; foreach $key (sort numerically (keys %subnets)) { print "key = $key", "\n"; @subnet = split(/:/, $subnets{$key}); for ($i = 0; $i <=

RE: a print problem.

2005-05-17 Thread Wagner, David --- Senior Programmer Analyst --- WGO
Zhenhai Duan wrote: > Hi, > > I have a simple code but I just cannot get the correct result. Can > anyone take a look at the code for me? Many thanks. > > print "\nOutput: AS -- Subnets\n"; > foreach $key (sort numerically (keys %subnets)) { >print "key = $key", "\n"; >@subnet = split(/:/

inline GREP filter...

2005-05-17 Thread David Gilden
Hello, In the following I was thinking it would just print out: "Hello" #!/usr/bin/perl -w $S = "Hello, Perl!"; ($R) = grep {/\w+/} $S; print "$R\n"; I am trying for some sort of inline filtering so I can do the following: #!/usr/bin/perl -w use CGI qw/:standard/; use strict; my $page =

Re: inline GREP filter...

2005-05-17 Thread Philip M. Gollucci
David Gilden wrote: Hello, In the following I was thinking it would just print out: "Hello" #!/usr/bin/perl -w $S = "Hello, Perl!"; ($R) = grep {/\w+/} $S; print "$R\n"; I am trying for some sort of inline filtering so I can do the following: #!/usr/bin/perl -w use CGI qw/:standard/; use strict;

Re: RE: a print problem.

2005-05-17 Thread Zhenhai Duan
Wagner, Many thanks for the help. It turned out that the problem is related to the input file, where each line ends with both a \n and \r. It seems that chomp() has removed \n, but \r is still there, so that the key and value etc are not integers. I also noticed that if I read the file, and then

Thread queues don't seem to dequeue!

2005-05-17 Thread Siegfried Heintze
I'm trying to use the example on page 461 of Programming Perl. I've modified the code slightly and the problem is that the dequeue function seems to have no effect. I never see the print statement execute that indicates it has removed something from the queue. I do see the "New Thread starting" mes

timestamp conversion

2005-05-17 Thread DBSMITH
All, My goal is to get element 9 of stat which is mtime. I am getting this with ease, but my end goal is to convert this number back into a readable format giving me how old the file is. So here is a rough draft formula : (time in seconds - last MTime ) = seconds old. Convert seconds old t

Re: inline GREP filter...

2005-05-17 Thread John W. Krahn
David Gilden wrote: Hello, Hello, In the following I was thinking it would just print out: "Hello" #!/usr/bin/perl -w $S = "Hello, Perl!"; ($R) = grep {/\w+/} $S; grep() filters lists so if an element of the list on the right contains \w+ it will be passed through to the left but other elements wi

Removing multiple spaces

2005-05-17 Thread Dale
Hi, I'm trying to remove multiple spaces from a string but can't seemed to get it to do what I want without creating a long subroutine. I have a text file that contains various pieces of data that I want to import. However, there are gaps in between of various sizes. I want to cut them down to

RE: Removing multiple spaces

2005-05-17 Thread Wagner, David --- Senior Programmer Analyst --- WGO
Dale wrote: > Hi, > > I'm trying to remove multiple spaces from a string but can't seemed to > get it to do what I want without creating a long subroutine. > > I have a text file that contains various pieces of data that I want to > import. However, there are gaps in between of various sizes. I

Re: Removing multiple spaces

2005-05-17 Thread Peter Rabbitson
> $str =~ s/ / /i; > $str =~ s/ / /i; > $str =~ s// /i; > $str =~ s/ / /i; > $str =~ s/ / /i; > $str =~ s/ / /i; > $str =~ s// /i; > $str =~ s/ / /i; > $str =~ s/ / /i; is the same as: $str =~ s/\s{2,10}/ /; Read perldoc perlre, especially the part

HTTP Upload of a filehandle

2005-05-17 Thread Peter Rabbitson
Could somebody point me to a resource of how to upload a file using LWP via a data string or a filehandle such a string (I don't want to create a temp file on disk just to delete it after the upload). Thank you Peter -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail

Re: Removing multiple spaces

2005-05-17 Thread John W. Krahn
Dale wrote: Hi, Hello, I'm trying to remove multiple spaces from a string but can't seemed to get it to do what I want without creating a long subroutine. I have a text file that contains various pieces of data that I want to import. However, there are gaps in between of various sizes. I want t

Re: Removing multiple spaces

2005-05-17 Thread John W. Krahn
Peter Rabbitson wrote: $str =~ s/ / /i; $str =~ s/ / /i; $str =~ s// /i; $str =~ s/ / /i; $str =~ s/ / /i; $str =~ s/ / /i; $str =~ s// /i; $str =~ s/ / /i; $str =~ s/ / /i; is the same as: $str =~ s/\s{2,10}/ /; Not quite. The \s character class incl

Re: Removing multiple spaces

2005-05-17 Thread Dale
Hi David Wagner, you wrote: $str =~ s/\s+/ /g; This will take one or more white space and replace all found with one space. If you only want a space then s/ +/ /g would be what you want. white space would cover tabs and spaces. Thanks for the reply. I thought that using + would look for m

Re: Removing multiple spaces

2005-05-17 Thread Dale
Hi Peter Rabbitson, you wrote: $str =~ s/ / /i; $str =~ s/ / /i; $str =~ s// /i; $str =~ s/ / /i; $str =~ s/ / /i; $str =~ s/ / /i; $str =~ s// /i; $str =~ s/ / /i; $str =~ s/ / /i; is the same as: $str =~ s/\s{2,10}/ /; Read perldoc perlre, especially

Re: Removing multiple spaces

2005-05-17 Thread Peter Rabbitson
> >>$str =~ s/ / /i; > > > >is the same as: > > > >$str =~ s/\s{2,10}/ /; > > Not quite. The \s character class includes more than just the ' ' > character. > My bad :D -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

perl afs module

2005-05-17 Thread shoker
Hi all I am trying to learn perl. I am using perl afs module to administer our afs cell. my problem is, the attached script is forking a new process and is not releasing the memory as iam new to programming I am pretty sure i am doing some simple mistake I would be really thankfull if one of

Re: A very general question to perl experts

2005-05-17 Thread John W. Krahn
Madhur Kashyap wrote: Hello Perl Experts, Hello, I am facing a problem day-in and day-out with my perl code. There are a couple of subroutines in it. Below I am writing the stub-form of my perl code. [code moved to the end of message] I am calling lot of subroutines in updateNetPairsDB () subrouti

RE: timestamp conversion

2005-05-17 Thread Charles K. Clarkson
[EMAIL PROTECTED] wrote: : All, : : My goal is to get element 9 of stat which is mtime. I am : getting this with ease, but my end goal is to convert this : number back into a readable format giving me how old the file : is. Are you sure mtime tracks file age? I wa

RE: Compare to multiple numbers

2005-05-17 Thread Charles K. Clarkson
[EMAIL PROTECTED] wrote: : Why doesn't this work to check the until it is one of the : numbers "1 2 3 4 5" ?? I have tried multiple variations of this with : different brackets ie. [ ] , and ( ) . List::MoreUtils exports a function named 'any'. It will allow you t

Re: columnwise analysis

2005-05-17 Thread Aditi Gupta
hi, is guess_alphabet a predefined function in the following code? my @counters = (); while (my $row = <$fh>) { my @cols = split /\s*-\s*/, $row; for (my $i = 0; $i < @cols; ++$i) { my $code = guess_alphabet($cols[$i]); ++$counters[$i]{$code}; } } it was giving errors.. please help.. thanks

extracting columns

2005-05-17 Thread Aditi Gupta
Hi everybody, to extract data columnwise from a file, the following code was written with the help of perl experts of this list. the script is as follows: #!usr/bin/perl u

Re: columnwise analysis

2005-05-17 Thread Xavier Noria
On May 18, 2005, at 7:55, Aditi Gupta wrote: is guess_alphabet a predefined function in the following code? my @counters = (); while (my $row = <$fh>) { my @cols = split /\s*-\s*/, $row; for (my $i = 0; $i < @cols; ++$i) { my $code = guess_alphabet($cols[$i]);

Re: perl afs module

2005-05-17 Thread John W. Krahn
[EMAIL PROTECTED] wrote: Hi all Hello, I am trying to learn perl. I am using perl afs module to administer our afs cell. my problem is, the attached script is forking a new process and is not releasing the memory as iam new to programming I am pretty sure i am doing some simple mistake I would be

RE: extracting columns

2005-05-17 Thread Ankur Gupta
From: Aditi Gupta [mailto:[EMAIL PROTECTED] > Hi everybody, > to extract data columnwise from a file, the following code > was written with the help of perl experts of this list. the > script is as follows: > > -- > -

Re: extracting columns

2005-05-17 Thread Xavier Noria
On May 18, 2005, at 8:03, Aditi Gupta wrote: for (my $j=0; $j<$x; $x++) The last one would surely be $j++. the code isn't giving any errors but it also isn't printing the result as well. Please someone tell me why is this happeining.. Please, next time format your code using standard conventions,

RE: extracting columns

2005-05-17 Thread Thomas Bätzler
Aditi Gupta <[EMAIL PROTECTED]> wrote: > to extract data columnwise from a file, the following code > was written with the help of perl experts of this list. the > script is as follows: > #!usr/bin/perl > use warnings; use strict; > my %hash; > > $file= "try.txt"; > > open (FH, $file) or di