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
Hi,
Need your help with the following:-
I have a csv file having many records.
I want to remove duplicate records. But the record might not be entirely
duplicate. I only have to check if the 2nd, 3rd, 7th and 8th field of a
record is same as the earlier records. If it is same, then remove the
[EMAIL PROTECTED] wrote:
Small correction
Try
open my F, 'outputsample1' or
die 'Failed to open outputsample1';
my $f = \*F;
while (($key, $value) = each %hash)
{
print $f $value.\n;
}
close $f;
Yaron.
It would help if you tested your code before you published it.
Hi,
Did you try to use XML::TrePP. It seems to fit your needs.
http://search.cpan.org/~kawasaki/XML-TreePP-0.22/lib/XML/TreePP.pm
Yaron Kahanovitch
- Original Message -
From: Prabu Ayyappan [EMAIL PROTECTED]
To: perl Beginner beginners@perl.org
Sent: Wednesday, August 1, 2007 9:51:49
Small correction
Try
open my F, 'outputsample1' or
die 'Failed to open outputsample1';
my $f = \*F;
while (($key, $value) = each %hash)
{
print $f $value.\n;
}
close $f;
Yaron Kahanovitch
- Original Message -
From: [EMAIL PROTECTED]
To: Mihir Kamdar [EMAIL
Hi,
Your You did not open the output file correctly.
You try to store the File handler in a variable.
If you wish to do so open the file and store reference to the file handle.
Instead of using
open my $f, '', 'outputsample1' or
die 'Failed to open outputsample1';
while (($key, $value)
Mihir Kamdar wrote:
But I am not getting the desired result.
What are the desired results? How is your output different from what you
expect?
--
Just my 0.0002 million dollars worth,
Shawn
For the things we have to learn before we can do them, we learn by doing them.
Aristotle
--
Mihir Kamdar wrote:
But the output I get is not comma seperated but space seperated:-
Change this line:
$hash{$cdr[2],$cdr[3],$cdr[6],$cdr[7]}=@cdr; #Add some more cdr key fields
if u want.
To:
$hash{$cdr[2],$cdr[3],$cdr[6],$cdr[7]}=$line; #Add some more cdr key fields if
u want.
--
Hi,
The code was tested. and it compiles for mee
Yaron
- Original Message -
From: Rob Dixon [EMAIL PROTECTED]
To: beginners@perl.org
Sent: Wednesday, August 1, 2007 2:23:44 PM (GMT+0200) Auto-Detected
Subject: Re: Removing duplicate records
[EMAIL PROTECTED] wrote:
Small
Thanks Shawn,Yaron,Rob
Thanks a lot for your prompt response...
The solution is desirable...
On 8/1/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
Hi,
The code was tested. and it compiles for mee
Yaron
- Original Message -
From: Rob Dixon [EMAIL PROTECTED]
To:
Prabu Ayyappan wrote:
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
Hi,
The result is ok, but one big problem. My input file is a csv file. Its
records are like:
2007/02/26 09:38:03,999,+60320840888,+60123773138,,1,5,2007/02/26
09:37:582,1,0,7,1,3,1,,0,4,+60320840888,,BRT70607,NOKIA_160_ISDN,,KL,KL
2007/02/26
Hi,
I have a requirement to read each of the files from a directory and pass
each one of them as a parameter to my perl script one by one. The
requirement is such that my perl script should keep running in the
background and it should take each of the files as they enter into the
target
Hello Rob,
Almost anything is better
than XML::Simple, but no module can easily make your data any smaller.
I use XML::Simple without any problems since some years. Which problems
could I get with with this package?
My programm converts many small xml-files (100kb) to a perl structure
daily.
[EMAIL PROTECTED] wrote:
Hi,
The code was tested. and it compiles for mee
What version of Perl are you using that accepts this?
open my F, 'outputsample1' or die 'Failed to open outputsample1';
Rob
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL
Hi Rob,
My requirement is like this:-
There is a parent directory where the input files will be stored. These
files will keep on coming into the parent directory. There is a child
directory where these input files will just get touched(0 byte files).
I have to read the name of the file from the
Mihir Kamdar wrote:
Hi,
Hello,
Need your help with the following:-
I have a csv file having many records.
I want to remove duplicate records. But the record might not be entirely
duplicate. I only have to check if the 2nd, 3rd, 7th and 8th field of a
record is same as the earlier records.
On 8/1/07, Somu [EMAIL PROTECTED] wrote:
Cant we use this to store arrays?
To what does the word this refer? To the dbmopen function, somehow,
for that was the whole of the subject line? Or to the code which
follows? Or both?
Example:
[EMAIL PROTECTED];
No; that code will evaluate the name
Mihir Kamdar wrote:
I have a requirement to read each of the files from a directory and pass
each one of them as a parameter to my perl script one by one. The
requirement is such that my perl script should keep running in the
background and it should take each of the files as they enter into
Cant we use this to store arrays? Example:
[EMAIL PROTECTED];
i'm getting errors.. Which will be a good alternate? Joining the
array elements and saving as a string to be parsed later or saving a
ref to the array?
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail:
Thomas Polnik wrote:
Almost anything is better than XML::Simple, but no module can
easily make your data any smaller.
I use XML::Simple without any problems since some years. Which
problems could I get with with this package? My programm converts
many small xml-files (100kb) to a perl
John W. Krahn wrote:
Mihir Kamdar wrote:
I want to remove duplicate records. But the record might not be entirely
duplicate. I only have to check if the 2nd, 3rd, 7th and 8th field of a
record is same as the earlier records. If it is same, then remove the
previous or the last entry. I have
On 8/1/07, Mihir Kamdar [EMAIL PROTECTED] wrote:
There is a parent directory where the input files will be stored. These
files will keep on coming into the parent directory.
When you say keep on coming, what do you mean? Do you mean that
another process is writing these files elsewhere (i.e.,
It has to be ASAP Shawn..but if that's not possible, as a workaround we
may also look at every half hour or something like that...
do you have any suggestions in mind?
I am also unaware how to scan the directory for each of the fileslike in
shell i can do something like
for i in 'ls -lrt
hey Tom,
There is no question of half finished files...because only files that are
finished being written will be touched in the child directory.
So any touched file in the child directory will have a fully written input
file in the parent directory.
That's precisely the reason that first I will
Mihir Kamdar wrote:
On 8/1/07, Rob Dixon [EMAIL PROTECTED] wrote:
Mihir Kamdar wrote:
I have a requirement to read each of the files from a directory and pass
each one of them as a parameter to my perl script one by one. The
requirement is such that my perl script should keep running in the
Mihir Kamdar wrote:
Also, these input files will keep on coming from some source. So, my perl
file has to run continuously and pick each of the files as they come.
How quickly does the Perl program have to process these files? ASAP, once an
hour, once a day?
--
Just my 0.0002 million
yep Rob...u re right...
the code that u've posted should do good...am yet to test it
Thanks,
Mihir
On 8/1/07, Rob Dixon [EMAIL PROTECTED] wrote:
Mihir Kamdar wrote:
On 8/1/07, Rob Dixon [EMAIL PROTECTED] wrote:
Mihir Kamdar wrote:
I have a requirement to read each of the files
hey Rob,
Can you explain with reference to your code, what does this do:
my $access = (stat $fname)[8];
On 8/1/07, Paul Lalli [EMAIL PROTECTED] wrote:
On Aug 1, 11:14 am, [EMAIL PROTECTED] (Mihir Kamdar) wrote:
It has to be ASAP Shawn..but if that's not possible, as a workaround
we
Also.after reading each file and processing it, I want to write the
output for each of them to a different directory.
@Paul:
my process_file($file) would scan the file and remove duplicate records from
the file and write the o/p into another
directory. That part is taken care of.
On 8/1/07,
Before reading the above comments I used the localtime function of
Time::Local to convert the dates into epochs and then comparing
numerically.
But thanks as i was not knowing that the strings i.e 2007-12-01 and
2007-12-02 can be compared using the string operators for dates. Can
anyone point me
Hello all,
I am new to perl. I am trying to analyze and insert do database some
data from bunch of weird unicode log files. I did manage to complete
Unicode and database part but now log analysis - thats the area where
I need some help...
Log file has following structure:
i believe it returns the permissions of the file
to $access.
-Original Message-
From: Mihir Kamdar [EMAIL PROTECTED]
Sent: Aug 1, 2007 10:49 AM
To: Paul Lalli [EMAIL PROTECTED]
Cc: beginners@perl.org
Subject: Re: Passing each of the files in a directory as parameter to the perl
script
On 7/31/07, Mr. Shawn H. Corey [EMAIL PROTECTED] wrote:
Programming is a rigorous discipline. Learning to do things right the first
time around achieves two things:
1. You don't have to unlearn bad habits before you learn the good ones.
2. Understanding the concepts behind the practice
On Aug 1, 11:14 am, [EMAIL PROTECTED] (Mihir Kamdar) wrote:
It has to be ASAP Shawn..but if that's not possible, as a workaround we
may also look at every half hour or something like that...
So enter an infinite loop in which you process the directory, sleep
one second, process the
On Jul 28, 9:55 pm, [EMAIL PROTECTED] (Tony Heal) wrote:
I am looking for a good IDE for perl, I have eclipse and one of it's plugins,
but I am wondering if I a spinning my
wheels trying to set this up when there may be a better alternative.
Tony Heal
ActiveState Komodo - it is the best.
On Aug 1, 11:57 am, [EMAIL PROTECTED] (Mihir Kamdar) wrote:
On 8/1/07, Paul Lalli [EMAIL PROTECTED] wrote:
my %already_seen;
while (1) {
opendir my $dh, '.' or die Could not open this directory: $!;
while (my $file = readdir($dh)) {
next if $file =~ /^\.\.?$/;
Mr. Shawn H. Corey wrote:
John W. Krahn wrote:
Mihir Kamdar wrote:
I want to remove duplicate records. But the record might not be entirely
duplicate. I only have to check if the 2nd, 3rd, 7th and 8th field of a
record is same as the earlier records. If it is same, then remove the
previous or
On 8/1/07, jeevs [EMAIL PROTECTED] wrote:
Before reading the above comments I used the localtime function of
Time::Local to convert the dates into epochs and then comparing
numerically.
But thanks as i was not knowing that the strings i.e 2007-12-01 and
2007-12-02 can be compared using the
jeevs wrote:
Before reading the above comments I used the localtime function of
Time::Local to convert the dates into epochs and then comparing
numerically.
But thanks as i was not knowing that the strings i.e 2007-12-01 and
2007-12-02 can be compared using the string operators for dates. Can
Mihir Kamdar wrote:
Can you explain with reference to your code, what does this do:
my $access = (stat $fname)[8];
In my last post I asked you to please bottom-post your responses to
this group. That means to put your reply after the text of the
message you are replying to.
If you look at
Mr. Shawn H. Corey wrote:
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.
Programming is a rigorous discipline. Learning to do things right the
first time
On Aug 1, 5:02 am, [EMAIL PROTECTED] (Jeevs) wrote:
Before reading the above comments I used the localtime function of
Time::Local to convert the dates into epochs and then comparing
numerically.
But thanks as i was not knowing that the strings i.e 2007-12-01 and
2007-12-02 can be compared
Hi list,
I'm using some design patterns (MVC, Observer, Strategy), with Perl, however I
see that I need to create some interfaces (watching examples in Java and C++),
but I don't know how to create these interfaces with Perl, for example in Java
this is done with this:
public interface
On 8/1/07, Rafael Morales [EMAIL PROTECTED] wrote:
Hi list,
I'm using some design patterns (MVC, Observer, Strategy), with Perl, however
I see that I need to create some interfaces (watching examples in Java and
C++), but I don't know how to create these interfaces with Perl, for example
On Aug 1, 3:40 pm, [EMAIL PROTECTED] (Luke) wrote:
I am new to perl. I am trying to analyze and insert do database some
data from bunch of weird unicode log files. I did manage to complete
Unicode and database part but now log analysis - thats the area where
I need some help...
Log file has
On Aug 1, 2:20 pm, [EMAIL PROTECTED] (Rafael Morales) wrote:
I'm using some design patterns (MVC, Observer, Strategy), with Perl,
however I see that I need to create some interfaces (watching examples
in Java and C++), but I don't know how to create these interfaces with
Perl, for example in
Jay Savage wrote:
Strings compare character by character, from left to right, so
2 = 2
2 == 2, '2' eq '2'
0 = 0
7 = 7
- = -
'-' == '-' (argument is not numeric)(x2), '-' eq '-'
1 = 1
1 2
10 2, '10' lt '2'
--
Just my 0.0002 million dollars worth,
Shawn
For the things we have
I don't see what I am doing wrong here. I am trying to print to the
filehandle LINOUT but nothing is being printed to the file.
Ultimately I want to monitor the input file and when it is written to I
want to take the update and put into another file for processing.
#!/usr/bin/perl
use strict;
Johnson, Reginald (GTI) wrote:
I don't see what I am doing wrong here. I am trying to print to the
filehandle LINOUT but nothing is being printed to the file.
Ultimately I want to monitor the input file and when it is written to I
want to take the update and put into another file for processing.
Mihir Kamdar wrote:
It has to be ASAP Shawn..but if that's not possible, as a workaround
we may also look at every half hour or something like that...
do you have any suggestions in mind?
Well, if I could change anything, I'd change my program to a deamon and have it
listen on a socket.
On Aug 1, 2:48 pm, [EMAIL PROTECTED] ([EMAIL PROTECTED]) wrote:
# Looks like the file is small so simply treating it as a single
string is
# likely to be the simplest approach.
# In reality you'd need to slurp the file in a Unicode-aware way
Wow, thanks a million !!! :D
Luke
--
To
Okay, I know this has to be simple, but because I am trying to truncate
or remove a special character I've run into a roadblock. Here's what I
want to do.
$value = 12345) ;
How do I change $value so that the trailing ) is removed. In
otherwords with the given example, how do I manipulate
On 8/1/07, Mr. Shawn H. Corey [EMAIL PROTECTED] wrote:
Jay Savage wrote:
Strings compare character by character, from left to right, so
2 = 2
OP asked why this particular date format sorts correctly using string
comparison. I wasn't giving example code (you might have noticed the
complete
-Original Message-
From: Bret Goodfellow [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 01, 2007 14:25
To: beginners@perl.org
Subject: How do I truncate or remove a trailing character
Okay, I know this has to be simple, but because I am trying
to truncate
or remove a special
On 08/01/2007 02:51 PM, Johnson, Reginald (GTI) wrote:
I don't see what I am doing wrong here. I am trying to print to the
filehandle LINOUT but nothing is being printed to the file.
Ultimately I want to monitor the input file and when it is written to I
want to take the update and put into
OK, this is for a MVC implementation, but all examples I have seen are done
with Java or C++, even php5 which uses the same
keyword interface, and this interface is a way for comunicate between classes.
- Original Message -
From: Paul Lalli [EMAIL PROTECTED]
To: beginners@perl.org
Wagner, David --- Senior Programmer Analyst --- WGO wrote:
From: Bret Goodfellow [mailto:[EMAIL PROTECTED]
Okay, I know this has to be simple, but because I am trying to
truncate or remove a special character I've run into a roadblock.
Here's what I want to do.
$value = 12345) ;
How do
Bret Goodfellow wrote:
Okay, I know this has to be simple, but because I am trying to truncate
or remove a special character I've run into a roadblock. Here's what I
want to do.
$value = 12345) ;
How do I change $value so that the trailing ) is removed. In
otherwords with the given
On Aug 1, 6:25 pm, [EMAIL PROTECTED] (Rafael Morales) wrote:
OK, this is for a MVC implementation, but all examples I have seen are done
with Java or C++, even php5 which uses the same
keyword interface, and this interface is a way for comunicate between
classes.
Do you know what it is you
Rafael Morales wrote:
I'm using some design patterns (MVC, Observer, Strategy), with Perl,
however I see that I need to create some interfaces (watching
examples in Java and C++), but I don't know how to create these
interfaces with Perl, for example in Java this is done with this:
public
-Original Message-
From: Jay Savage [EMAIL PROTECTED]
Sent: Aug 2, 2007 5:29 AM
To: Perl List beginners@perl.org
Subject: Re: parsing a log file by date
'2 == 2' is a Perl test for numeric equality, which has nothing to do
with string comparisons. '1 = 1', on the other hand, is a
An interface is a kind of contract that need to be respected by all the
classes that implement that interface.
All those classes should have the methods specified by the interface and
those methods should have the same signature (they are able to receive the
same parameters types).
Perl is
On 8/2/07, Mr. Shawn H. Corey [EMAIL PROTECTED] wrote:
Mihir Kamdar wrote:
It has to be ASAP Shawn..but if that's not possible, as a workaround
we may also look at every half hour or something like that...
do you have any suggestions in mind?
Well, if I could change anything, I'd
64 matches
Mail list logo