Re: Very Sluggish Code

2012-07-11 Thread Jenda Krynicky
From: GlenM > # Read them into an array > my @files_in_dir = grep { /xml/ } readdir(DIR); You want all files with lowercase "xml" anywhere the the name? Really? I think you want my @files_in_dir = grep { /\.xml$/i } readdir(DIR); instead. That is files with extension .xml. > closedir DIR; >

Re: Very Sluggish Code

2012-06-11 Thread timothy adigun
Hi GlenM, Please my comments below: On Mon, Jun 11, 2012 at 7:06 PM, GlenM wrote: > Hello Folks; > > I see an earlier post about sluggish code - I am not really sure what I am > doing, so I let me post my entire script here. > > +++

Re: Very Sluggish Code

2012-06-11 Thread Ken Slater
On Mon, Jun 11, 2012 at 9:36 PM, Ken Slater wrote: > On Mon, Jun 11, 2012 at 2:06 PM, GlenM wrote: >> Hello Folks; >> >> I see an earlier post about sluggish code - I am not really sure what I am >> doing, so I let me

Re: Very Sluggish Code

2012-06-11 Thread Ken Slater
On Mon, Jun 11, 2012 at 2:06 PM, GlenM wrote: > Hello Folks; > > I see an earlier post about sluggish code - I am not really sure what I am > doing, so I let me post my entire script here. > > ++ > > #!/usr/bin/perl &g

Very Sluggish Code

2012-06-11 Thread GlenM
Hello Folks; I see an earlier post about sluggish code - I am not really sure what I am doing, so I let me post my entire script here. ++ #!/usr/bin/perl #use strict; use DBI; use XML::XPath; use XML::XPath::XMLParser; # Set the input dir where

Re: Sluggish code

2012-06-11 Thread John W. Krahn
venkates wrote: Hi all, Hello, I am trying to filter files from a directory (code provided below) by comparing the contents of each file with a hash ref (a parsed id map file provided as an argument). The code is working however, is extremely slow. The .csv files (81 files) that I am reading

Re: Sluggish code

2012-06-11 Thread Jim Gibson
On Jun 11, 2012, at 7:31 AM, venkates wrote: > Hi all, > > I am trying to filter files from a directory (code provided below) by > comparing the contents of each file with a hash ref (a parsed id map file > provided as an argument). The code is working however, is extremely slow. > The .csv

Re: Sluggish code

2012-06-11 Thread Liutauras Diu
It's hard to suggest improvement seeing only a fragment of entire code for, but I would probably expect your code to be slow as you have 5 nested for each loops: while ( my @data_files = grep(/\.csv$/,readdir(DH)) ) ... foreach my $file ( @data_files ) ... while ( my $data = <$FH>

Re: Sluggish code

2012-06-11 Thread Rob Coops
On Mon, Jun 11, 2012 at 4:31 PM, venkates wrote: > Hi all, > > I am trying to filter files from a directory (code provided below) by > comparing the contents of each file with a hash ref (a parsed id map file > provided as an argument). The code is working however, is extremely slow. > The .csv

Sluggish code

2012-06-11 Thread venkates
Hi all, I am trying to filter files from a directory (code provided below) by comparing the contents of each file with a hash ref (a parsed id map file provided as an argument). The code is working however, is extremely slow. The .csv files (81 files) that I am reading are not very large (l