Re: reading a line at a time inefficient?

2006-06-22 Thread Omega -1911
On 6/23/06, Jeff Peng <[EMAIL PROTECTED]> wrote: >Thanks for the reply Jeff, but what I need to do is assign variables based >on the first 5 lines and then push the remaining lines of the file into an >array. Any suggestions? > Anyway,reading all the contents of a large file to an array should

Re: reading a line at a time inefficient?

2006-06-22 Thread Jeff Peng
Thanks for the reply Jeff, but what I need to do is assign variables based on the first 5 lines and then push the remaining lines of the file into an array. Any suggestions? Anyway,reading all the contents of a large file to an array should consume too much physical memory.Could you take a l

Re: reading a line at a time inefficient?

2006-06-22 Thread Omega -1911
On 6/23/06, Jeff Peng <[EMAIL PROTECTED]> wrote: Hello, Reading a file which is large as 900M to the array,should consume memory too quickly. Could you open a file and obtain the file-handle in your subroutine,then return the file-handle to the caller?For example: sub your_sub{ ope

Re: reading a line at a time inefficient?

2006-06-22 Thread Jeff Peng
Hello, Reading a file which is large as 900M to the array,should consume memory too quickly. Could you open a file and obtain the file-handle in your subroutine,then return the file-handle to the caller?For example: sub your_sub{ open (FH,$somefile) or die $!; return \*FH; } F

Re: reading a line at a time inefficient?

2006-06-22 Thread Omega -1911
Hello list! I am attempting to lower the memory load on the server that the following lines of code creates. Is there any way to speed up this process and lower memory usage? I read through FILE::SLURP documentation but not sure if that would help as I need to keep the array @remaining_file_lines

Re: '-d' with '>' creates errors

2006-06-22 Thread Tom Phoenix
On 6/22/06, tom arnall <[EMAIL PROTECTED]> wrote: invoking a perl script with '#!/usr/perl -wd' in its first line and with './myscript >t' on the command line, What are you trying to do? The output redirection is confusing to the debugger. If you're trying to make a transcript of your debugge

'-d' with '>' creates errors

2006-06-22 Thread tom arnall
invoking a perl script with '#!/usr/perl -wd' in its first line and with './myscript >t' on the command line, i get as below. i have done this kind of thing many times, but never with this result. also, the script runs fine if i drop '>t' from the invocation, or drop '-d' from the first line o

Re: should be a seamless upgrade?

2006-06-22 Thread Tom Phoenix
On 6/22/06, tom arnall <[EMAIL PROTECTED]> wrote: without quitting the current session. It should be a seamless upgrade WHILE WE ARE RUNNING... That means that you don't need to restart the CPAN shell to benefit from the upgrade. You do, however, have to download, build, test, and install

should be a seamless upgrade?

2006-06-22 Thread tom arnall
There's a new CPAN.pm version (v1.87) available! [Current version is v1.7601] You might want to try install Bundle::CPAN reload cpan without quitting the current session. It should be a seamless upgrade WHILE WE ARE RUNNING... do not the cap'd words mean that i can continue doing

RE: Another (hopefully more clear) plea for help with CSV data

2006-06-22 Thread Charles K. Clarkson
Chad Perrin wrote: : On Thu, Jun 22, 2006 at 03:07:32AM -0500, Charles K. Clarkson wrote: :: ::: OK, so here is the task. The first row I want to turn into ::: variable names. Machine, PurgeSuccess, etc. :: :: You probably don't want to do that. You may end up needing :: symbolic references t

Re: converting between time and string

2006-06-22 Thread JupiterHost.Net
Hello, $refTime = "01:22:33,456"; #as in your example $refTime =~ /(\d+):(\d+):(\d+),(\d+)/; #capture the elements and assign $hours = $1; $minutes = $2; $secs = $3; $mili = $4; or much simpler: my($hours, $minutes, $secs, $mili) = $ref_time =~ m{(\d+)}g; Note that if it doesn't match then t

RE: Another (hopefully more clear) plea for help with CSV data

2006-06-22 Thread Timothy Johnson
Here's one thought: Why not create a hash of arrays? Each hash key would be a column name, and each record would be spread across the arrays using the same array index. If you really wanted to get fancy you could create a hash of cached results to speed up future queries. I wouldn't recommend it

Re: converting between time and string

2006-06-22 Thread Mark Harris
bnj.s wrote: Hello, I have a file with lots of times in the format "01:22:33,456", where the numbers after the comma represent the milliseconds. I would like to reduce all these times by a given offset. I first thought to convert the string to a sort of date format, and then to do a minus o

Re: Handle date structured folders - CORRECTIO

2006-06-22 Thread John Ackley
argument 2 of DateCalc() should be "$days days ago" NOT "$days ago" sorry John Ackley wrote: Khairul Azmi wrote: Hi all, I have this problem. There is a script that stores log files into folders that follows structure of the following /MM/DD eg.. /var/log/projects/2006/06/20/8231.tgz

Re: Handle date structured folders

2006-06-22 Thread John Ackley
Khairul Azmi wrote: Hi all, I have this problem. There is a script that stores log files into folders that follows structure of the following /MM/DD eg.. /var/log/projects/2006/06/20/8231.tgz /var/log/project1/2006/06/21/1432.tgz /var/log/projects/2006/06/22/1756.tgz /var/log/projects/20

Re: converting between time and string

2006-06-22 Thread Dr.Ruud
"bnj.s" schreef: > I have a file with lots of times in the format "01:22:33,456", where > the numbers after the comma represent the milliseconds. > > I would like to reduce all these times by a given offset. I first > thought to convert the string to a sort of date format, and then to > do a minus

Error connecting to 'http://ppm.ActiveState.com/cgibin/PPM/ppmserver.pl?urn:/PPMServer'

2006-06-22 Thread Ley, Chung
Hi, I am trying to use PPM to install some module, I am running version 2.2.0. But I got this error... Is there something happening on the server side or is this some thing that I need to check with my network? Is this has to do with ActiveState spinning out? I am sorry, I didn't know who

Re: Handle date structured folders

2006-06-22 Thread Chad Perrin
On Thu, Jun 22, 2006 at 04:45:25PM +0800, Khairul Azmi wrote: > Hi all, > I have this problem. There is a script that stores log files into folders > that follows structure of the following > > /MM/DD > > eg.. > > /var/log/projects/2006/06/20/8231.tgz > /var/log/project1/2006/06/21/1432.tgz

Re: converting between time and string

2006-06-22 Thread Muma W.
bnj.s wrote: Hello, I have a file with lots of times in the format "01:22:33,456", where the numbers after the comma represent the milliseconds. I would like to reduce all these times by a given offset. [...] You can use POSIX::mktime to convert the string into a time value, but the millis

Re: Another (hopefully more clear) plea for help with CSV data

2006-06-22 Thread Chad Perrin
On Thu, Jun 22, 2006 at 03:07:32AM -0500, Charles K. Clarkson wrote: > > : OK, so here is the task. The first row I want to turn into > : variable names. Machine, PurgeSuccess, etc. > > You probably don't want to do that. You may end up needing > symbolic references to access those variables

RE: Trying to add hyperlink

2006-06-22 Thread Charles K. Clarkson
chen li wrote: : How to convert the format above into an OOP style when : adding a hyperlink? I am afraid many people might : have typo if they follow the format above. First, let's fix a few things with this implementation. Use the -w or the warnings pragma, not both. The preference is for

Re: Trying to add hyperlink

2006-06-22 Thread Scott Taylor
On Thu, June 22, 2006 09:25, chen li wrote: > > > --- Prabu <[EMAIL PROTECTED]> wrote: > >> Hello, >> >> Hope this is your need... >> >> #!/usr/bin/perl -w >> use warnings ; >> >> use CGI qw/:standard/; >> print header, start_html("Stsd ILO Links"), h1("Stsd >> ILO Links") ; >> >> print table({-bo

Re: Trying to add hyperlink

2006-06-22 Thread chen li
--- Prabu <[EMAIL PROTECTED]> wrote: > Hello, > > Hope this is your need... > > #!/usr/bin/perl -w > use warnings ; > > use CGI qw/:standard/; > print header, start_html("Stsd ILO Links"), h1("Stsd > ILO Links") ; > > print table({-border=>undef,,-width=>'75%', > -height=>'70%'}, > caption(s

Serial Ports

2006-06-22 Thread Scott Taylor
Hello all, I have a robot that sends data over a serial connection and I'd like to use Perl/Linux to listen to the Serial Port and record the data. Can anyone suggest the best package to do this? I need to be able to set Baud rates and such too. I'm looking at Device::SerialPort, but is that t

converting between time and string

2006-06-22 Thread bnj.s
Hello, I have a file with lots of times in the format "01:22:33,456", where the numbers after the comma represent the milliseconds. I would like to reduce all these times by a given offset. I first thought to convert the string to a sort of date format, and then to do a minus operation, and

Re: Handle date structured folders

2006-06-22 Thread Mr. Shawn H. Corey
On Thu, 2006-22-06 at 16:45 +0800, Khairul Azmi wrote: > Hi all, > I have this problem. There is a script that stores log files into folders > that follows structure of the following > > /MM/DD > > eg.. > > /var/log/projects/2006/06/20/8231.tgz > /var/log/project1/2006/06/21/1432.tgz > /var/

Re: Storing an array in a hash

2006-06-22 Thread Mr. Shawn H. Corey
On Thu, 2006-22-06 at 01:47 +, Jeff Peng wrote: > > > This conversion to and fro must be inefficient and time consuming. Is > > > there a "better" way to do this? > > > >Use an anonymous array: > > > > $array{$client} = [ @field ]; > > > > @field = @{ $array{$client} }; > > > > > > Or use

RE: Urgent :search and replace

2006-06-22 Thread Nagasamudram, Prasanna Kumar
Hi Preethi Can you try... perl -pi.bak -e 's/(ab=test1.*?dc=test3)/ab=chk1,bc=chk2/sg' filename [untested] Thanks Prasanna -Original Message- From: Preethi [mailto:[EMAIL PROTECTED] Sent: Thursday, June 22, 2006 3:21 PM To: Dr.Ruud Cc: beginners@perl.org Subject: Re: Urgent :sear

Re: Urgent :search and replace

2006-06-22 Thread Dr.Ruud
Preethi schreef: > The below solution ... should be above, but most probably snipped. Don't top-post, quote only relevant text, reply on each part that you quote. > did not work for me. My file runs almost to 1GB. What was the error message? Also show us the output of this: perl -wne ' $

Re: Urgent :search and replace

2006-06-22 Thread Preethi
Hi Ruud, Thanks for the input. I will take care of your inputs next time I post the message. The below solution did not work for me . My file runs almost to 1GB . All I have the string mentioned below. I even tried the following option perl -pi.bak -0777 -e 's/ab=test1, db=test2,dc=test3/ab=chk

Re: Urgent :search and replace

2006-06-22 Thread Dr.Ruud
Preethi schreef: Never put "Urgent" in the Subject. Never address "us" as Experts. Just explain your problem. Subject: search and replace on broken lines > I have wired problem , I have search and replace string in very huge > text file . The problem with the string is broken in the differenet

Handle date structured folders

2006-06-22 Thread Khairul Azmi
Hi all, I have this problem. There is a script that stores log files into folders that follows structure of the following /MM/DD eg.. /var/log/projects/2006/06/20/8231.tgz /var/log/project1/2006/06/21/1432.tgz /var/log/projects/2006/06/22/1756.tgz /var/log/projects/2006/06/23/1756.tgz Now

RE: Trying to add hyperlink

2006-06-22 Thread Nath, Alok (STSD)
Hi Prabhu, Your guess is right.For each box it should go to a different link. For e.g my references are like this. href="https://192.10.11.12. I want my code to be slightly simple. Thanx, Alok. -Original Message- From: Prabu [mailto:[EMAIL PROTECTED] Sent: Thurs

RE: Trying to add hyperlink

2006-06-22 Thread Charles K. Clarkson
Prabu wrote: : use CGI qw/:standard/; [snip] : th(['','Network Switch','Bay 1','Bay 2','Bay 3' ,'Network : Switch' ]), Sorry, that will produce invalid xhtml 1.0 Transitional, the default DOCTYPE for CGI.pm. Better to use the a() function already loaded into the main namespace by the 'use' st

Re: Trying to add hyperlink

2006-06-22 Thread Prabu
Hello Alok, FineBut each box needs to go to different link right.So it should be specified in each box .. If not can u a give me little more detailed requirement like on clicking the link in box where it should go.and so... -- Prabu.M.A When I was born I was so surprised

RE: Another (hopefully more clear) plea for help with CSV data

2006-06-22 Thread Charles K. Clarkson
Ralph H. Stoos Jr. wrote: Perl is a name, not an acronym. Write Perl or perl, but never PERL (unless you are yelling). : OK, so here is the task. The first row I want to turn into : variable names. Machine, PurgeSuccess, etc. You probably don't want to do that. You may end up needing s

RE: Trying to add hyperlink

2006-06-22 Thread Nath, Alok (STSD)
Hi Prabhu, Is there any simple way of doing it.Bcos this looks like user has to type a lot. Perl is known for its simplicity I suppose. Thanx, Alok. -Original Message- From: Prabu [mailto:[EMAIL PROTECTED] Sent: Thursday, June 22, 2006 12:06 PM To: Nath, Alok (STSD) Cc:

Re: Another (hopefully more clear) plea for help with CSV data

2006-06-22 Thread Dr.Ruud
"Ralph H. Stoos Jr." schreef: > Machine,PurgeSuccess,PurgePrepared,PurgeStarted,... > 1125785731,N,Y,Y,... > 1125785731,Y,Y,N, > > Above is the same slice of data. It all lines up in neat little > columns when you drop it into a spreadsheet. Admittedly, it could be > plopped into all sorts o

RE: Urgent :search and replace

2006-06-22 Thread Vijayakumaran, Vinod
You have 2 options: 1) Use pattern matching which would help in replacement s// 2) Try using split function $w=split(//,$string to search) 3) Try using substr function Substr($string to search, ) -Original Message- From: Preethi [mailto:[EMAIL PROTECTED] Sent: Thursday, June 22, 2006

Re: Trying to add hyperlink

2006-06-22 Thread Muma W.
Nath, Alok (STSD) wrote: Hi, I was trying to add a hyperlink to each of the boxes but it was not putting it in the right place.Can anyone help me in this regard ? [...] Try this: td([ a({href=>'http://url.example.com'}, 'My link text') ]) -- To unsubscribe, e-mail: [EMAIL PRO

Another (hopefully more clear) plea for help with CSV data

2006-06-22 Thread Ralph H. Stoos Jr.
All, I have been asked to do something in Access or Excel which I find disagreeable. Open Source is the way to go and also, PERL is more flexible. I might even obtain a little professional development on this. My last post seemed to confuse folks (thanks to all who responded). I will try to cl

Urgent :search and replace

2006-06-22 Thread Preethi
Hi Experts, I have wired problem , I have search and replace string in very huge text file . The problem with the string is broken in the differenet line. I'm having a string 'ab=test1, db=test2,dc=test3' and I want to replace this with 'ab=chk1,bc=chk2'. This string in the file is present in v