Re: Handeling huge hashes.

2006-04-23 Thread Rob Coops
Thanks for the tips, I think a combination of the two will be my best chance for this one. Store the bulk on disk or in a DB and use several smaller hashes to do the merging. After which I can retreive the bulk from disk/db while looping over the resulting combined hash. (note to self: must not fo

Re: golf

2006-04-23 Thread M. Kristall
John W. Krahn wrote: Chad Perrin wrote: On Fri, Apr 21, 2006 at 12:48:51PM -0700, John W. Krahn wrote: print/.*/g,$"while<> Yeah, that's it. Woah, that's pretty short. You can make it even shorter: print/.*/g,$"for<> They aren't quite the same though. 'while' loops if the condition is sti

Re: Coding Styles

2006-04-23 Thread M. Kristall
Brent Clark wrote: Hi all Hi there I seem to be having a few run ins with the "Project Leader", in terms of my coding style. Im very much for modularizing my work - hence the OO concept. That is creating packages using return in my subroutine etc (Oh and using strict) But the ex Cobol Projec

Re: golf

2006-04-23 Thread Dr.Ruud
"M. Kristall" schreef: > John W. Krahn: >> Chad Perrin: >>> John W. Krahn: print/.*/g,$"while<> > > Yeah, that's it. >>> Woah, that's pretty short. >> >> You can make it even shorter: >> >> print/.*/g,$"for<> > > They aren't quite the same though. 'while' loops if the condition is > still tr

Re: golf

2006-04-23 Thread Mr. Shawn H. Corey
On Sun, 2006-23-04 at 05:03 -0400, M. Kristall wrote: > John W. Krahn wrote: > > You can make it even shorter: > > > > print/.*/g,$"for<> > They aren't quite the same though. 'while' loops if the condition is > still true (scalar context). 'for' loops if there are more items in the > array (arra

RE: golf

2006-04-23 Thread Smith, Derek
-Original Message- From: John W. Krahn [mailto:[EMAIL PROTECTED] Sent: Friday, April 21, 2006 7:04 PM To: Perl Beginners Subject: Re: golf Chad Perrin wrote: > On Fri, Apr 21, 2006 at 12:48:51PM -0700, John W. Krahn wrote: >>print/.*/g,$"while<> > > Woah, that's pretty short. You can m

truncate

2006-04-23 Thread Smith, Derek
I want to use truncate to delete a matched line out a named.conf file on my DNS box. Here is my code use strict; use warnings; my $file = qq(/usr/local/admin/perl/derek_perl/test); open (FH, "+< $file"); while ( ) { unless (/\Acheck\-names/) { print $_;

Re: truncate

2006-04-23 Thread Mr. Shawn H. Corey
On Sun, 2006-23-04 at 13:29 -0400, Smith, Derek wrote: > use strict; > > use warnings; > > > > my $file = qq(/usr/local/admin/perl/derek_perl/test); > > open (FH, "+< $file"); > >while ( ) { > > if (/\Acheck\-names/) { > > my $addr=tell(FH); if( $addr < 0

Re: golf

2006-04-23 Thread Chad Perrin
On Sun, Apr 23, 2006 at 12:30:40PM -0400, Smith, Derek wrote: > > What is perl golf? It's like normal golf, only with Perl. You try to finish the program (or the 18-hole golf course) in as few (key)strokes as possible. In other words, Perl golf is the game of shortening a program without losing

Re: golf

2006-04-23 Thread John W. Krahn
M. Kristall wrote: > John W. Krahn wrote: >> Chad Perrin wrote: >>> On Fri, Apr 21, 2006 at 12:48:51PM -0700, John W. Krahn wrote: print/.*/g,$"while<> > Yeah, that's it. >>> Woah, that's pretty short. >> >> You can make it even shorter: >> >> print/.*/g,$"for<> > They aren't quite the same th

Re: truncate

2006-04-23 Thread John Ackley
Smith, Derek wrote: I want to use truncate to delete a matched line out a named.conf file on my DNS box. Here is my code use strict; use warnings; my $file = qq(/usr/local/admin/perl/derek_perl/test); open (FH, "+< $file"); while ( ) { unless (/\Acheck\-names/) {

Re: golf

2006-04-23 Thread Dr.Ruud
"Mr. Shawn H. Corey" schreef: > The expression 'while(<>)' is in scalar context. > It reads the file one line at a time. Rather one piece (or record) at a time, which by default is a line. The value of "$/" is the record separator; see `perldoc perlvar` for more information, such as special v

RE: truncate

2006-04-23 Thread Smith, Derek
-Original Message- From: Mr. Shawn H. Corey [mailto:[EMAIL PROTECTED] Sent: Sunday, April 23, 2006 1:51 PM To: Perl Beginners Subject: Re: truncate On Sun, 2006-23-04 at 13:29 -0400, Smith, Derek wrote: > use strict; > > use warnings; > > > > my $file = qq(/usr/local/admin/perl/derek

Re: golf

2006-04-23 Thread Mr. Shawn H. Corey
On Sun, 2006-23-04 at 13:23 -0700, John W. Krahn wrote: > "array context"?? There is no "array context". See `perldoc perlsyn` and search 'Foreach Loops'. All foreach loops iterate over a list. So you are right, it's not "array context", it's list context. For details, see `perldoc -q 'What is th

RE: truncate

2006-04-23 Thread Mr. Shawn H. Corey
On Sun, 2006-23-04 at 17:07 -0400, Smith, Derek wrote: > This does not work as my file still contains both lines. > check-names warn; > fooy > > when I want it to only contain > fooy That's not what truncate does. It chops off the end of the file. What you have to do is copy the contents to a tem

Re: Handeling huge hashes.

2006-04-23 Thread Jay Savage
Please don't top post. On 4/23/06, Rob Coops <[EMAIL PROTECTED]> wrote: > Thanks for the tips, I think a combination of the two will be my best chance > for this one. > > Store the bulk on disk or in a DB and use several smaller hashes to do the > merging. After which I can retreive the bulk from

clarification abt system function

2006-04-23 Thread Praveena Vittal
Hi All, I was unable to resolvet the following lines.Could any one please help me resolve the same? I could not find any user defined module named "system". System->get_renv(); System->get_receiver_dir(); Thanks in advance, Praveena -- To unsubscribe, e-mail: [EMAIL PROTECTED] For add

Running Perl Code in Windows

2006-04-23 Thread Mazhar
Hi Folks, i have written down a code in perl which is used as a file analyser. I need to run the same on Windows 2000. Should i need to install Active State Perl on the same. Is there any other alternative for running the same without installation of Active State Perl on the machine. Tha

Re: Running Perl Code in Windows

2006-04-23 Thread santhosh Yuvaraj
Hai, There is only one way to do this, converting 'pl' to 'exe' file. Here is the link u can download the per2exe package, http://www.indigostar.com/perl2exe.htm Best Rgds, Santhosh Yuvaraj. On 4/24/06, Mazhar <[EMAIL PROTECTED]> wrote: > > Hi Folks, > i have written down a code in pe

Re: golf

2006-04-23 Thread M. Kristall
With while(), the $_ is already local. Wouldn't using that 'local' explicitly, add another local-layer? my $i = 5; $_ = 'Hi there!!!'; while ($_ = $i--) { print } print 543210 my $i = 5; $_ = 'Hi there!!!'; while (local $_ = $i--) { print } print 54321Hi there!!! for (<>) is the same as for (r

Re: Running Perl Code in Windows

2006-04-23 Thread John Ackley
Mazhar wrote: Hi Folks, i have written down a code in perl which is used as a file analyser. I need to run the same on Windows 2000. Should i need to install Active State Perl on the same. Is there any other alternative for running the same without installation of Active State Perl on t