Re: filehandle question
On Tuesday 17 January 2006 09:30, radhika wrote: [ . . ] 409$plain_text .= $_ foreach ($fh); close $fh; --code end-- I keep getting this error: readline() on closed filehandle $fh at /home/ars/sys/libperl/site/ARS/REPORTS/AggregateFills.pm line 409. Is that above line with foreach is it a shorthand/substitute for: while ( $fh ) { $plain_text .= $_; } # end_of_code ??? yes/no ?? -- And, please of course *do* listen to Mr. Clarkson and Shawn Corey's replies on this thread/issue. -- Alan. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Transform column into row
Dear Perl users, what's the best way to transform column table in row format. I know how to split each line according to delimiter and than put it separately into array, but I have more complicated problem (with multiple equal records in the first column) id001 text1 id001 text2 id001 text3 id002 text23 id002 text555 id003 text666 and want something like: id001 text1 text2 text3 id002 text23 text 555 id003 text666 Thank's for any suggestions. Cheers, Andrej -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Win32::TieRegistry problem
Thanks very much Timothy, it is exactly what I want. In fact I forgotten to check the Key with definied I will add too strict and warnings to have a better code . It works fine, I will continue my tests. Best Regards OxX 2006/1/18, Timothy Johnson [EMAIL PROTECTED]: Is there a value called DisplayName in every key under Uninstall? My guess is that you will find on the computers where this fails that there is a key that is incomplete, either from a partial uninstall or a badly installed program. By the way, I don't think you actually need to call the GetValue function. Win32::TieRegistry will handle this for you. All you need to do is something like this: # use strict; use warnings; use Win32::TieRegistry (Delimiter = '/'); my $swKey = $Registry-{LMachine/Software/Microsoft/Windows/CurrentVersion/Uninstal l/}; my @ls= keys( %{$swKey} ); my $p ='0'; my %list_soft = (); foreach my $entry (@ls ){ my $Key = $Registry-{LMachine/Software/Microsoft/Windows/CurrentVersion/Uninstal l/$entry}; my $valueString = $Key-{DisplayName}; if(defined $valueString){ $valueString =~ s/ //g; $list_soft{$valueString} = $p; } } ## Also, you are forgetting to 'use strict' and 'use warnings'. You should always use strict and warnings. -Original Message- From: OXx [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 17, 2006 4:13 PM To: beginners@perl.org Subject: Win32::TieRegistry problem Hello I have a problem with this module. My script does not work with all pcs . In fact when I execute it on my computer I have no problem but in an other one I have this error: *Can't call method GetValue on an undefined value* An extract of my script: $Registry-Delimiter(/); $swKey= $Registry-{LMachine/Software/Microsoft/Windows/CurrentVersion/Uninstal l/}; @ls= keys( %{$swKey} ); $p ='0'; %list_soft = (); foreach $entry (@ls ) { $Key= $Registry-{LMachine/Software/Microsoft/Windows/CurrentVersion/Uninstal l/$entry}; *$valueString= $Key-GetValue(DisplayName);* $valueString=~s/ //g; $list_soft{$valueString} = $p; } Thanks for your help Oxx
Re: Transform column into row
Andrej Kastrin am Mittwoch, 18. Januar 2006 10.49: Dear Perl users, what's the best way to transform column table in row format. I know how to split each line according to delimiter and than put it separately into array, but I have more complicated problem (with multiple equal records in the first column) id001 text1 id001 text2 id001 text3 id002 text23 id002 text555 id003 text666 and want something like: id001 text1 text2 text3 id002 text23 text 555 id003 text666 Thank's for any suggestions. My suggestion is that you show us what you tried so far, since this list is not a script service. joe -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Transform column into row
On Wed, Jan 18, 2006 at 01:34:01PM +0100, John Doe wrote: Andrej Kastrin am Mittwoch, 18. Januar 2006 10.49: Dear Perl users, what's the best way to transform column table in row format. I know how to split each line according to delimiter and than put it separately into array, but I have more complicated problem (with multiple equal records in the first column) id001 text1 id001 text2 id001 text3 id002 text23 id002 text555 id003 text666 and want something like: id001 text1 text2 text3 id002 text23 text 555 id003 text666 Thank's for any suggestions. My suggestion is that you show us what you tried so far, since this list is not a script service. But he didn't ask for a script, he asked for suggestions on the best way to do something. [As a side note, and not directed specifically to John Doe, this list seems to be becoming a little less friendly to beginners than it used to be. I think that is a shame. Of course, no one wants to be taken advantage of, but a little slap of the wrist whilst providing some clues and pointers seems to be a reasonable compromise.] In most programming problems, I find that if you can design the correct data structures the code pretty much writes itself. In this case, the correct data structure seems to be a hash of arrays. See perldoc perldsc. With this data structure, and the knowledge you already have, I would expect a solution to present itself. If you still have problems, do as John Doe suggests, and come back to us with the code you have already tried. -- Paul Johnson - [EMAIL PROTECTED] http://www.pjcj.net -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Transform column into row
Paul Johnson am Mittwoch, 18. Januar 2006 13.53: On Wed, Jan 18, 2006 at 01:34:01PM +0100, John Doe wrote: Andrej Kastrin am Mittwoch, 18. Januar 2006 10.49: Dear Perl users, what's the best way to transform column table in row format. I know how to split each line according to delimiter and than put it separately into array, but I have more complicated problem (with multiple equal records in the first column) id001 text1 id001 text2 id001 text3 id002 text23 id002 text555 id003 text666 and want something like: id001 text1 text2 text3 id002 text23 text 555 id003 text666 Thank's for any suggestions. My suggestion is that you show us what you tried so far, since this list is not a script service. But he didn't ask for a script, he asked for suggestions on the best way to do something. You are right. I apologize for that as well as for my tone. Partly it is due to my bad english, I miss the subtilities. [As a side note, and not directed specifically to John Doe, this list seems to be becoming a little less friendly to beginners than it used to be. I think that is a shame. There are some people on the list, especially J.W. Krahn (and others), who are always very polite with any kind of questions :-) [...] In most programming problems, I find that if you can design the correct data structures the code pretty much writes itself. In this case, the correct data structure seems to be a hash of arrays. See perldoc perldsc. With this data structure, and the knowledge you already have, I would expect a solution to present itself. If you still have problems, do as John Doe suggests, and come back to us with the code you have already tried. Another way (I don's say a better :-) ) could be not using a data structure, but doing the transformation on the fly: - read a line of the input data - record the first or a new field name while scanning (id001 etc.) - if the field name is new / has changed, output it to a new file - if it is not new / has not changed, append the value(s) - repeat these steps joe -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Transform column into row (correction)
John Doe am Mittwoch, 18. Januar 2006 15.30: [...] Another way (I don's say a better :-) ) could be not using a data structure, but doing the transformation on the fly: - read a line of the input data - record the first or a new field name while scanning (id001 etc.) - if the field name is new / has changed, output it to a new file - if it is not new / has not changed, append the value(s) - repeat these steps open input file and new output file read a line of the input data and record the field name (id001 etc.) if the field name is new / has changed, output a newline (exept for the first line), the field name and the value. if it is not new / has not changed, output only the value. read next line from input file and repeat procedure close files joe -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Transform column into row
snip My suggestion is that you show us what you tried so far, since this list is not a script service. But he didn't ask for a script, he asked for suggestions on the best way to do something. [As a side note, and not directed specifically to John Doe, this list seems to be becoming a little less friendly to beginners than it used to be. I think that is a shame. Of course, no one wants to be taken advantage of, but a little slap of the wrist whilst providing some clues and pointers seems to be a reasonable compromise.] snip I agree with Paul. I have not been on this list since 2002 and the level of hostility that has grown in the last three years is frightening. We are often the first exposure people have to the Perl community and we want them to come away with a good feeling about Perl and the community around it. We will have plenty of time later to rip them new ones. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Transform column into row
Andrej Kastrin wrote: Dear Perl users, Howdy what's the best way to transform column table in row format. I know how to split each line according to delimiter and than put it separately into array, but I have more complicated problem (with multiple equal records in the first column) id001 text1 id001 text2 id001 text3 id002 text23 id002 text555 id003 text666 and want something like: id001 text1 text2 text3 id002 text23 text 555 id003 text666 Use the first column as a key to a hash and make the value an array ref: my %end_results; for my $line_arrayref(@records) { push @{ $end_results{$line_arrayref-[0]} }, $line_arrayref-[1] } now %end_results looks like: 'id001' = ['text1', 'text2', 'text3'], 'id002' = ['text23', 'text', '555'], 'id003' = ['text666'], You could do the same thing with map also... HTH :) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: Transform column into row
-Original Message- From: John Doe [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 18, 2006 7:34 AM To: beginners@perl.org Subject: Re: Transform column into row Andrej Kastrin am Mittwoch, 18. Januar 2006 10.49: Dear Perl users, what's the best way to transform column table in row format. I know how to split each line according to delimiter and than put it separately into array, but I have more complicated problem (with multiple equal records in the first column) id001 text1 id001 text2 id001 text3 id002 text23 id002 text555 id003 text666 and want something like: id001 text1 text2 text3 id002 text23 text 555 id003 text666 Thank's for any suggestions. If you own a copy of Perl Cookbook, look at chapter 5.7 Hashes with Multiple Values Per Key c:/brian/text_files/cook_5_7.txt = id001 text1 id001 text2 id001 text3 id002 text23 id002 text555 id003 text666 --- hash_mult_values.pl - #!/usr/bin/perl use strict; use warnings; my %texts = (); my $file = c:/brian/text_files/cook_5_7.txt; open (FILE, $file) or die Can't open $file: $!; while (FILE) { my ($id, $text) = split; push( @{$texts{$id}}, $text ); } foreach my $id (sort keys %texts) { print $id: @{$texts{$id}}\n; } - end hash_mult_values.pl Gives the result: C:\brian\perlperl hash_mult_values.pl id001: text1 text2 text3 id002: text23 text555 id003: text666 Hope this helps, Brian Volk -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Problem with perl module
I have installed perl fresh from the source, and loaded some modules via -MCPAN. I am getting the following error message when I try to use Proc::ProcessTable. [EMAIL PROTECTED] ~/v3src]$ kill-processes -p gnuplot Storable binary image v2.7 more recent than I am (v2.6) at ../../lib/Storable.pm (autosplit into ../../lib/auto/Storable/_retrieve.al) line 328, at /usr/lib/per l5/site_perl/5.8.7/i686-linux-thread-multi/Proc/ProcessTable.pm line 89 I use this on other systems, but cannot get it to work on this particular system. Any help would be appreciated. Connie Logg SLAC -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Problem with perl module
snip I have installed perl fresh from the source, and loaded some modules via -MCPAN. I am getting the following error message when I try to use Proc::ProcessTable. [EMAIL PROTECTED] ~/v3src]$ kill-processes -p gnuplot Storable binary image v2.7 more recent than I am (v2.6) at ../../lib/Storable.pm (autosplit into ../../lib/auto/Storable/_retrieve.al) line 328, at /usr/lib/per l5/site_perl/5.8.7/i686-linux-thread-multi/Proc/ProcessTable.pm line 89 snip This might not be much help, but it looks like you have a version missmatch for the Storable module. Have you tried to upgrade it yet? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: Problem with perl module
Hummm...I made and installed the latest perl version yesterday [EMAIL PROTECTED] ~]$ /usr/bin/perl -v This is perl, v5.8.7 built for i686-linux-thread-multi Should I try to reinstall storable via /usr/bin/perl -MCPAN -e install Storable ? Thanks, Connie -Original Message- From: Chas Owens [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 18, 2006 9:25 AM To: Logg, Connie A. Cc: beginners@perl.org Subject: Re: Problem with perl module snip I have installed perl fresh from the source, and loaded some modules via -MCPAN. I am getting the following error message when I try to use Proc::ProcessTable. [EMAIL PROTECTED] ~/v3src]$ kill-processes -p gnuplot Storable binary image v2.7 more recent than I am (v2.6) at ../../lib/Storable.pm (autosplit into ../../lib/auto/Storable/_retrieve.al) line 328, at /usr/lib/per l5/site_perl/5.8.7/i686-linux-thread-multi/Proc/ProcessTable.pm line 89 snip This might not be much help, but it looks like you have a version missmatch for the Storable module. Have you tried to upgrade it yet? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Problem with perl module
On 1/18/06, Logg, Connie A. [EMAIL PROTECTED] wrote: Hummm...I made and installed the latest perl version yesterday [EMAIL PROTECTED] ~]$ /usr/bin/perl -v This is perl, v5.8.7 built for i686-linux-thread-multi Should I try to reinstall storable via /usr/bin/perl -MCPAN -e install Storable ? Thanks, Connie snip Yes. Storable is not a core module, therefore it will not have been upgraded with your version of Perl. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
SCO OSR5 and DBI
Hello, I'm trying to install DBI modules and I'm getting the following message from 'make': gcc -c-DPERL_SCO -DPERL_SCO507 -DHAS_FPSETMASK -D_REENTRANT -march=i 586 -mcpu=i586 -O6 -fomit-frame-pointer-DVERSION=\1.50\ -DXS_VERSION=\1. 50\ -fPIC -I/usr/lib/perl5/5.8/i586-pc-sco3.2v5.0/CORE -W -Wall -Wpointer-ar ith -Wbad-function-cast -Wno-comment -Wno-sign-compare -Wno-cast-qual -DDBI_NO_T HREADS Perl.c In file included from /usr/include/netinet/in.h:93, from /usr/lib/perl5/5.8/i586-pc-sco3.2v5.0/CORE/perl.h:880, from DBIXS.h:19, from Perl.xs:5: /usr/include/netinet/in6.h:25: sys/convsa.h: No such file or directory In file included from /usr/lib/perl5/5.8/i586-pc-sco3.2v5.0/CORE/perl.h:880, from DBIXS.h:19, from Perl.xs:5: /usr/include/netinet/in.h:100: sys/convsa.h: No such file or directory In file included from /usr/lib/perl5/5.8/i586-pc-sco3.2v5.0/CORE/perl.h:979, from DBIXS.h:19, from Perl.xs:5: /usr/include/netdb.h:60: sys/convsa.h: No such file or directory In file included from /usr/lib/perl5/5.8/i586-pc-sco3.2v5.0/CORE/perl.h:1528, from DBIXS.h:19, from Perl.xs:5: /usr/include/ieeefp.h:34: warning: `__i386' redefined *Initialization*:1: warning: this is the location of the previous definition *** Error code 1 (bu21) Can anyone tell me what it means? Can I install DBI on OSR5.07? I seem to get a lot of errors when trying to compile anything on this machine. Cheers in adv. -- Scott -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: SCO OSR5 and DBI
On 1/18/06, Scott Taylor [EMAIL PROTECTED] wrote: Hello, I'm trying to install DBI modules and I'm getting the following message from 'make': gcc -c-DPERL_SCO -DPERL_SCO507 -DHAS_FPSETMASK -D_REENTRANT -march=i 586 -mcpu=i586 -O6 -fomit-frame-pointer-DVERSION=\1.50\ -DXS_VERSION=\1. 50\ -fPIC -I/usr/lib/perl5/5.8/i586-pc-sco3.2v5.0/CORE -W -Wall -Wpointer-ar ith -Wbad-function-cast -Wno-comment -Wno-sign-compare -Wno-cast-qual -DDBI_NO_T HREADS Perl.c In file included from /usr/include/netinet/in.h:93, from /usr/lib/perl5/5.8/i586-pc-sco3.2v5.0/CORE/perl.h:880, from DBIXS.h:19, from Perl.xs:5: /usr/include/netinet/in6.h:25: sys/convsa.h: No such file or directory In file included from /usr/lib/perl5/5.8/i586-pc-sco3.2v5.0/CORE/perl.h:880, from DBIXS.h:19, from Perl.xs:5: /usr/include/netinet/in.h:100: sys/convsa.h: No such file or directory In file included from /usr/lib/perl5/5.8/i586-pc-sco3.2v5.0/CORE/perl.h:979, from DBIXS.h:19, from Perl.xs:5: /usr/include/netdb.h:60: sys/convsa.h: No such file or directory In file included from /usr/lib/perl5/5.8/i586-pc-sco3.2v5.0/CORE/perl.h:1528, from DBIXS.h:19, from Perl.xs:5: /usr/include/ieeefp.h:34: warning: `__i386' redefined *Initialization*:1: warning: this is the location of the previous definition *** Error code 1 (bu21) Can anyone tell me what it means? Can I install DBI on OSR5.07? I seem to get a lot of errors when trying to compile anything on this machine. Cheers in adv. -- Scott -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response It sounds like you don't have all of the prerequiste libraries or headers installed (there error message is due to a missing header). I would suggest you look for your installation media and see if there are and packages (or whatever SCO uses) marked devel. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: How to take a reference in line
Bill Gradwohl [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Using the example below (partially taken from Learning PERL Objects), I can't seem to figure out how to take a reference to an array in-line. snip / my $arrayPointer; # This works: @{$arrayPointer}=qw(Money preserver sunscreen); check_required_items(Mr. Howell, $arrayPointer); # These don't work: check_required_items(Mr. Howell, @{$arrayPointer}=qw(Money preserver sunscreen)); check_required_items(Mr. Howell, qw(Money preserver sunscreen)); How do I tell Perl to give me a reference to an array in the last 2 statements? There's got to be a way to pass a reference without having to explicitly name a variable. Right? You bet: check_required_items(Mr. Howell, [qw(Money preserver sunscreen)] ); a generic construct looks like this: my $array_ref = [ 'foo', 'bar', 'bazz' ]; perldoc perlref Todd W. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Transform column into row
Andrej Kastrin schreef: id001 text1 id001 text2 id001 text3 id002 text23 id002 text555 id003 text666 and want something like: id001 text1 text2 text3 id002 text23 text 555 id003 text666 $ perl -MData::Dumper -aF -ne \ 'push @{$HoA{$F[0]}}, $F[1];} {END{print Dumper %HoA}' \ infile or: #!/usr/bin/perl use strict; use warnings; my %HoA; while () { my ($group, $member) = split; push @{$HoA{$group}}, $member; } { local ($,, $\) = (\t, \n); for my $group (keys %HoA) { print $group:, @{$HoA{$group}}; } } See `perldoc perldsc`, look for HASHES OF ARRAYS. -- Grtz, Ruud -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Problem with perl module
On 1/18/06, Logg, Connie A. [EMAIL PROTECTED] wrote: Storable binary image v2.7 more recent than I am (v2.6) at ../../lib/Storable.pm This is Perl's Storable module, which is used by the module you're trying to use. It seems to be telling you that it's finding a binary (compiled) file that's the wrong version. I suspect that you've got more than one Storable module on your system, and the right one isn't the first one found in the @INC directories. (See about @INC in perlvar.) Double-check your library directories, to be sure they're searched in the right order. But if you haven't changed them (by altering @INC, using 'use lib', with command-line switches, or when compiling Perl, maybe other ways), re-installing Storable may help. Good luck with it! --Tom Phoenix Stonehenge Perl Training -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Transform column into row
Andrej Kastrin am Mittwoch, 18. Januar 2006 10.49: Dear Perl users, what's the best way to transform column table in row format. I know how to split each line according to delimiter and than put it separately into array, but I have more complicated problem (with multiple equal records in the first column) id001 text1 id001 text2 id001 text3 id002 text23 id002 text555 id003 text666 and want something like: id001 text1 text2 text3 id002 text23 text 555 id003 text666 Ok, in addition to my apologies, I present here the script I described in my last post. In constrast to the other presented solutions using a a hash slurping all data from the intput file, the advantage of my solution is that it is *capable to handle 300GB input files* even with 128MB RAM. === #!/usr/bin/perl use strict; use warnings; # open input file here if source is not DATA open (my $outf, '', './andrey_kastrin.out.txt') or die Can't open file: $!; my $old_name=''; while (DATA) { chomp; my ($name, $value)=$_=~/^([\w]+)\s+(.*)$/; if ($old_name ne $name) { print $outf \n if $old_name; print $outf $_; } else { print $outf ' ',$value; } $old_name=$name; } close $outf or die Can't close file: $!; # close input file here if source is not DATA __DATA__ id001 text1 id001 text2 id001 text3 id002 text23 id002 text555 id003 text666 === It outputs: id001 text1 text2 text3 id002 text23 text555 id003 text666 I'm a nice guy, see? joe -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Large Uploads
Hello, we are setting up a multi-upload form with a max., of 4 uploads. right now we're handling approx., 1-2mb files per upload(4 at a time), without any problems, and now what to set it up for files up to 50mb's per upload(4 at a time). this is a web based application form. is there a recommended method or proceedure, to prevent possible time-outs when uploading files that large, up to 4 files at a time ? any feedback would be much appreciated. TIA -- Mike(mickalo)Blezien -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Large Uploads
Tom, Tom Phoenix wrote: On 1/18/06, Mike Blezien [EMAIL PROTECTED] wrote: is there a recommended method or proceedure, to prevent possible time-outs There aren't any time-outs built into Perl. Problem solved. :-) any feedback would be much appreciated. What time-out are you worried about? Perhaps you would be better served by asking in a discussion forum about whatever it is (a webserver, a browser, a protocol) that has the time out issue. Good luck with it! well, this is what I'm trying to anticipate ahead of time, if we can upload 4 files that large without running into this issue with either a browser time-out or server time out(which would be pretty much out of my control). I guess we'll just have to experiment too see what happens. thx's for your input. :) -- Mike(mickalo)Blezien -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Transform column into row
John Doe wrote: Andrej Kastrin am Mittwoch, 18. Januar 2006 10.49: Dear Perl users, what's the best way to transform column table in row format. I know how to split each line according to delimiter and than put it separately into array, but I have more complicated problem (with multiple equal records in the first column) id001 text1 id001 text2 id001 text3 id002 text23 id002 text555 id003 text666 and want something like: id001 text1 text2 text3 id002 text23 text 555 id003 text666 Ok, in addition to my apologies, I present here the script I described in my last post. In constrast to the other presented solutions using a a hash slurping all data from the intput file, the advantage of my solution is that it is *capable to handle 300GB input files* even with 128MB RAM. === #!/usr/bin/perl use strict; use warnings; # open input file here if source is not DATA open (my $outf, '', './andrey_kastrin.out.txt') or die Can't open file: $!; my $old_name=''; while (DATA) { chomp; my ($name, $value)=$_=~/^([\w]+)\s+(.*)$/; if ($old_name ne $name) { print $outf \n if $old_name; print $outf $_; } else { print $outf ' ',$value; } $old_name=$name; } close $outf or die Can't close file: $!; # close input file here if source is not DATA __DATA__ id001 text1 id001 text2 id001 text3 id002 text23 id002 text555 id003 text666 === It outputs: id001 text1 text2 text3 id002 text23 text555 id003 text666 I'm a nice guy, see? joe many many thanks forall suggestions... Cheers, Andrej -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response