compare between two Associative Arrays

2002-01-02 Thread Nisim, Amit
Hi All, I need to compare between two Associative Arrays How can I do it ? Is there a better way then insert all values in regular arrays and to compare between the two ? Amit -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Issue Unix command in Perl and get back the result

2002-01-02 Thread John W. Krahn
Families Laws wrote: > > The Unix command is: `cp -ip $file1 $file2`. I needed > to know if the cp operation is successful. I tried > $result = `cp -ip $file1 $file2`; > $result does not contain any value after the execution > even when $file1 does not exist. > > How can I find out if the 'cp' o

Re: Issue Unix command in Perl and get back the result

2002-01-02 Thread Peter Scott
At 10:21 PM 1/2/02 -0800, Families Laws wrote: >The Unix command is: `cp -ip $file1 $file2`. I needed >to know if the cp operation is successful. I tried >$result = `cp -ip $file1 $file2`; >$result does not contain any value after the execution >even when $file1 does not exist. > >How can I find o

Issue Unix command in Perl and get back the result

2002-01-02 Thread Families Laws
The Unix command is: `cp -ip $file1 $file2`. I needed to know if the cp operation is successful. I tried $result = `cp -ip $file1 $file2`; $result does not contain any value after the execution even when $file1 does not exist. How can I find out if the 'cp' operation is successful or not ? Thank

Re: find blank line

2002-01-02 Thread Michael R. Wolf
"Hanson, Robert" <[EMAIL PROTECTED]> writes: > One way is to do this... > > while ( my $line = ) { > next if ( /^\s*$/ ); > } NO! NO! NO! NO! NO! NO! NO! NO! NO! NO! NO! NO! NO! NO! Your loop sets $line (but not $_), but your RE checks $_ (but not $line). There are two solutions to yo

Re: how to get and setup Perl

2002-01-02 Thread Dragon Nebula Web Design
Scott Lutz wrote: > There are Perl development GUI's available, ( I saw one, once in > passing, way back ), but mostly development is done with a text editor. > You can go to www.activestate.com and get VisualPerl if you so wish. > > Once you get past the initial first script, a simple > %perl

RE: how to get and setup Perl

2002-01-02 Thread Scott Lutz
There are Perl development GUI's available, ( I saw one, once in passing, way back ), but mostly development is done with a text editor. You can go to www.activestate.com and get VisualPerl if you so wish. Once you get past the initial first script, a simple %perl program_name.pl or %./p

Re: Question for those using gd.pm

2002-01-02 Thread Joelmon2001
I noticed gd.pm (version 1.15) is located at: /usr/lib/perl5/site_perl/5.005/i386-linux/GD.pm I need 1.3.7 Basically, it's an upgrade, and I will install (linux) from source. The question is, though, since I only found the GD.pm files and no other accompanying files that usually come in a Gdpm

Re: Capturing output

2002-01-02 Thread John W. Krahn
Michael McQuarrie wrote: > > Hello all. Can't figure this out...I execute the following scipt and the output of >the KSH pipe > is placed at the top of the log file instead of in order of when it was executed. > --- > Script looks like thi

Re: Why can't this two programs be piping?

2002-01-02 Thread Matthew Lyon
This goes beyond the scope of these scripts, but I've found some autoflushes to be less than perfect in all situations... I perfer to name pipes/handles and clamp them shut occasionally. That way I can ensure flow (at least outward) in .pl scripts. This is especially useful when a couple of di

Upgrading Perl

2002-01-02 Thread Robert
How can I (actually whats the best way?) upgrade an existing Perl(5.6.0) to (5.6.1). This is on RH7.2. Thanks -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Why can't this two programs be piping?

2002-01-02 Thread John W. Krahn
Mariana añez wrote: > > I wrote this two scripts (to do "./mynum | ./mycount" on linux shell): > > mynum: > > #*** > # Write a number from 1 to oo > #** > >

how to get and setup Perl

2002-01-02 Thread Edwin Davidson
Guys: This is a VERY basic question. I'm in the process of getting Redhat 7.2 Linux which had Perl bundled with it. After I get Linux setup, how do I 'use' Perl ? I'll explain. When I install Visual Basic I hit a shortcut and in I go. I can create apps with the project manager as I'm sure yo

Re: compare between two arrays

2002-01-02 Thread Jeff 'japhy' Pinyan
On Jan 2, John W. Krahn said: >> I want to compare between two arrays. >> $a = (join " ",@a); >> $b = (join " ",@b); >> if ($b eq $a) { print "equal";} > >Well you _can_ do this in one line. :-) > >$ perl -le'@a = qw(one two three four); @b = qw(one two three four); >print "equal" if "@a" eq "@b

Re: compare between two arrays

2002-01-02 Thread John W. Krahn
Amit Nisim wrote: > > Hi All, Hello, > I want to compare between two arrays. > How can I do it ? > > One way I know is : > > $a = (join " ",@a); > $b = (join " ",@b); > if ($b eq $a) { print "equal";} Well you _can_ do this in one line. :-) $ perl -le'@a = qw(one two three four); @b = qw(o

RE: find blank line

2002-01-02 Thread Jeff 'japhy' Pinyan
On Jan 2, Booher Timothy B 1stLt AFRL/MNAC said: >Why is ((/^\*+/) or (/^\s*$/)) improper? > >It breaks down to: >( (/^\*+/) or (/^\s*$/) ) Yes... but neither of those are testing $line, they're testing $_. >How is this different than: "next if $line =~ /^\*+/ or $line =~ /^\s*$/;" >except tha

RE: find blank line

2002-01-02 Thread Booher Timothy B 1stLt AFRL/MNAC
Why is ((/^\*+/) or (/^\s*$/)) improper? It breaks down to: ( (/^\*+/) or (/^\s*$/) ) How is this different than: "next if $line =~ /^\*+/ or $line =~ /^\s*$/;" except that it is less ambiguous? tim

RE: find blank line

2002-01-02 Thread Jeff 'japhy' Pinyan
On Jan 2, Booher Timothy B 1stLt AFRL/MNAC said: >First of all, why do I need to use defined() here is my code: You don't. >next if $line =~ ((/^\*+/) or (/^\s*$/)); That isn't written properly. next if $line =~ /^\*+/ or $line =~ /^\s*$/; Although, the first regex can be simplified to

RE: find blank line

2002-01-02 Thread Jeff 'japhy' Pinyan
On Jan 2, [EMAIL PROTECTED] said: >That's right. But let me add my 5cents to it. If you decide to use the >construct "while ( )..." then it better be >while( defined() ) { >//... >} Not so. First, doing defined() does not store a line in $_ -- for that, you'd need defined($_ = ). Second, whi

RE: find blank line

2002-01-02 Thread Booher Timothy B 1stLt AFRL/MNAC
First of all, why do I need to use defined() here is my code: #!/usr/bin/perl -w # open(MYFILE,'test2.txt'); $lNum = 1; while (my $line = ){ chomp($line); next if $line =~ ((/^\*+/) or (/^\s*$/)); @splitLine = split(/:\s/,$line); print "$lNum\: \"$splitLine[0]\" And \"$s

RE: find blank line

2002-01-02 Thread Jeff 'japhy' Pinyan
On Jan 2, [EMAIL PROTECTED] said: >open( MYFILE, "file.txt" ) or die; >while ( my $line = ) { >my ($a); // $a is undefined now. >$line =~ /(\w+)\d+$/; >$a = $1; // $a may be undef still if the preceding expression did not >evaluate to true >print "Value of a is <$a>\n"; // S

RE: find blank line

2002-01-02 Thread SathishDuraisamy
That's right. But let me add my 5cents to it. If you decide to use the construct "while ( )..." then it better be while( defined() ) { //... } [sathish] -Original Message- From: Jeff 'japhy' Pinyan [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 02, 2002 2:44 PM To: Booher Timothy

Re: Nested IF

2002-01-02 Thread John W. Krahn
Michael Simmons wrote: > > Does anyone see what the problem with this is? > > if ( $tline[$i] =~ /^$name\s/ ) { > if ( $tline[$i] =~ /\scname\s/ ) { > print "Found the following alias: \n"; > print "$tline[$i]; > } > elsif ( $t

RE: find blank line

2002-01-02 Thread SathishDuraisamy
Could you tell what you do inside the while loop? If you declare local variables and assign values to them from the contents read from file, then chances are that the values read from the file are null and the variables still unassigned. For example, open( MYFILE, "file.txt" ) or die; while ( my

RE: find blank line

2002-01-02 Thread Jeff 'japhy' Pinyan
On Jan 2, Booher Timothy B 1stLt AFRL/MNAC said: >Thanks so much - only one problem: when I try to use while (my $line = >) { etc } I get a bunch of errors similar to this one: > >Use of uninitialized value at JustForTest.pl line 13, chunk 5. > >Do you know what I am doing wrong? The code given

RE: find blank line

2002-01-02 Thread Booher Timothy B 1stLt AFRL/MNAC
Thanks so much - only one problem: when I try to use while (my $line = ) { etc } I get a bunch of errors similar to this one: Use of uninitialized value at JustForTest.pl line 13, chunk 5. Do you know what I am doing wrong? Thanks, tim Tim

Re: find blank line

2002-01-02 Thread Shawn
Hey Tim, This will check for lines that have nothing but white space in them and skip them. White space includes newlines as well... Shawn open(F,'file.txt'); while() { next if(/^\s*$/); blah... } close(F); - Original Message - From: "Booher Timothy B 1stLt AFRL/MNAC" <[EMAIL P

RE: find blank line

2002-01-02 Thread Hanson, Robert
One way is to do this... while ( my $line = ) { next if ( /^\s*$/ ); } Rob -Original Message- From: Booher Timothy B 1stLt AFRL/MNAC [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 02, 2002 5:19 PM To: [EMAIL PROTECTED] Subject: find blank line When parsing a text file -

find blank line

2002-01-02 Thread Booher Timothy B 1stLt AFRL/MNAC
When parsing a text file - what is the best way to skip a "blank" line - when I find the length I get a length of 1 (perhaps the newline). I know that I could chomp($_) and then if(length($_) != 0) {do something} else {next} but I feel that there should be a way to have an if($_ = $blank) statemen

RE: C vs. Perl

2002-01-02 Thread Maciejewski, Thomas
1) in 5 years the computers will be faster ... actually there is that law that will tell you how much faster it will be ... 2) you can often get complex code to run faster by optimizing parts of code that are your bottleneck ( threading, caching, reusable objects, iteration vs recursion, etc ...

Capturing output

2002-01-02 Thread Michael McQuarrie
Hello all. Can't figure this out...I execute the following scipt and the output of the KSH pipe is placed at the top of the log file instead of in order of when it was executed. --- Script looks like this: --

Re: C vs. Perl

2002-01-02 Thread Roger C Haslock
Chosing the appropriate algorithm can make orders of magnitude of difference in execution time. There are many problems where the appropriate algorithm for a small data set is inappropriate for a large data set, for example. Perl does, indeed, provide many ways to implement something, and it does

RE: C vs. Perl

2002-01-02 Thread Chris Spurgeon
> 2) I am not exactly sure what you mean by "profiled your Perl", however I do > do benchmarks on code. I am in the process of redesigning our website, and > thus taking this opportunity to improve upon old scripts that will need > changing anyways. Current improvements to our main script have

[ADMIN - THREAD CLOSED] C vs. Perl

2002-01-02 Thread Kevin Meltzer
Hello folks, I am closing this thread. Although it is a very interesting conversation to have with people, this really isn't the place for it. Feel free to continue it off-list with interested parties, but consider this thread closed and do not respond to the list itself. Thanks for your cooperat

Re: C vs. Perl

2002-01-02 Thread Agustin Rivera
Thank-you to everyone for the responses. Roger, 1) I am personally obsessed with effeciency. This is why I am considering moving to C or C++. 2) I am not exactly sure what you mean by "profiled your Perl", however I do do benchmarks on code. I am in the process of redesigning our website, and th

Re: compare between two arrays

2002-01-02 Thread Adriano Rodrigues Ferreira
>I want to compare between two arrays. This is what you want? $fail = 0; if (@a!=@b) { $fail = 1; } else { for ( $i=0; $i<@a; $i++ ) { if ($a[$i]==$b[$i]) { next; } else { $fail = 1; last; } } } if ($fail) { print "not equal\n"; } else { print "equal\n"; }

Re: Why can't this two programs be piping?

2002-01-02 Thread Agustin Rivera
Try while () { <-- change my $num = $_; <-- change chop $num; next if(!($num=~m/(^([0-9]+)$)/)); $sum=$sum+$num; Agustin Rivera Webmaster, Pollstar.com http://www.pollstar.com - Original Message - From: "Mariana Añez" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wedn

FW: C vs. Perl

2002-01-02 Thread Busse, Rich
This might have been beaten to death today, but I'd like to add my $0.02: 1. You Linux guru says "C would be faster than Perl"? Prove it. Are there any specific benchmarks? Probably not. Remember, assembly language is faster than C! 2. Just this morning I wrote a 3 line Perl fragment to run a pr

RE: Parsing large text files

2002-01-02 Thread Scott
Rob: Thanks for all of your help. I hope to help others as soon as I get the swing of perl more. -Scott On Wed, 2 Jan 2002, Hanson, Robert wrote: > "Should I put a while in front of the line processing?" > > Yup. > > while ( my $record = ) { > ... > } > close (NEWQUOTES); > close (Q

RE: Parsing large text files

2002-01-02 Thread Hanson, Robert
"Should I put a while in front of the line processing?" Yup. while ( my $record = ) { ... } close (NEWQUOTES); close (QUOTEP); Rob -Original Message- From: Scott [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 02, 2002 2:50 PM To: Hanson, Robert Cc: [EMAIL PROTECTED] Subject: R

Re: Question for those familiar with imagemagick for perl

2002-01-02 Thread Joelmon2001
Thank you for the reply. However, I get a broken image I cannot avoid problems with text, it's really weird. Maybe the problem is I need a full path to the font? I even tried '@font.ttf'. Should I install ghostscript and only rely on those type of fonts? Do font paths need to be full? it's stra

RE: Parsing large text files

2002-01-02 Thread Scott
Ok, I think I have it opening the file correctly, now I want to create a loop to process every record in the file. With the code below it does one line and stops. Should I put a while in front of the line processing? Thanks, open(QUOTEP,"$qivQuoteFile"); open(NEWQUOTES, ">newtest5.txt");

RE: C vs. Perl

2002-01-02 Thread Bob Showalter
> -Original Message- > From: Hanson, Robert [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, January 02, 2002 2:21 PM > To: 'Maciejewski, Thomas' > Cc: [EMAIL PROTECTED] > Subject: RE: C vs. Perl > > > No flames from me. > > One of Perl's strong/weak points is that there are too many ways

RE: Re[2]: C vs. Perl

2002-01-02 Thread Maciejewski, Thomas
last thought ... I think the point here is that in java you don't need two processes rather the servlet engine runs and spawns off threads as needed ... so you can share the information freely between threads ... I was wondering if this is possible in perl? -Original Message- From: Da

Re[2]: C vs. Perl

2002-01-02 Thread Daniel Gardner
Wednesday, January 02, 2002, 7:06:34 PM, Maciejewski, Thomas wrote: > how ? > through CGI? > can you post an example? i can't say i've ever tried to build a perl with threading enabled, but there's always lots of discussion on the mod_perl mailing list about sharing data between processes. ta

Re: Extracting Titles from a bunch of HTML files

2002-01-02 Thread Roger C Haslock
1) my @line declares the array @line for the rest of the local block (ie for the next line). It declares a new, and empty, array each time round the while loop. 2) /=*([^=]+)/ a)=* zero or more equals signs [ Perhaps this should be =+ , that is, one or more ... ] b) [^=]+ one or more cha

Re: C vs. Perl

2002-01-02 Thread Roger C Haslock
There are many views on this. 1) Well designed and implemented C will be faster if the application is CPU-intensive. Is this the case? 2) Have you profiled your Perl? Have you experimented with the Inline module? 3) What is the expected lifetime of the code? Is it worth the additional cost of dev

RE: C vs. Perl

2002-01-02 Thread Brett W. McCoy
On Wed, 2 Jan 2002, Dean Theophilou wrote: > Your quote is incorrect, from what I remember, that is. It's more like "a more > wretched hive of scum and villainy" (sp?). *shrug* My quotes come up completely randomly -- I have no control over how accurate or not accurate they are. :-) -- Brett

RE: C vs. Perl

2002-01-02 Thread Brett W. McCoy
On Wed, 2 Jan 2002, Hanson, Robert wrote: > I don't deal with IPC, so I can't give you an example off the top of my > head. The perlfork manpage has a bunch of info though depending on what you > want to do, and there are probably a bunch of modules out there as well to > simplify the process.

RE: C vs. Perl

2002-01-02 Thread Brett W. McCoy
On Wed, 2 Jan 2002, Maciejewski, Thomas wrote: > heh ... again though in large groups ... this becomes a bit of a problem > since you all have to kind of be in sync with coding styles and courteous > coding This is more a part of the software development process than it is the responsibility of

RE: C vs. Perl

2002-01-02 Thread Dean Theophilou
Your quote is incorrect, from what I remember, that is. It's more like "a more wretched hive of scum and villainy" (sp?). Dean -Original Message- From: Brett W. McCoy [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 02, 2002 11:22 AM To: Maciejewski, Thomas Cc: 'Bob Showalter'; [EMA

Why can't this two programs be piping?

2002-01-02 Thread Mariana Añez
I wrote this two scripts (to do "./mynum | ./mycount" on linux shell): mynum: #*** # Write a number from 1 to oo #** #!/usr/bin/perl my $i=1; while ($i

RE: C vs. Perl

2002-01-02 Thread KeN ClarK
would it be rude to ask ya'll to take this thread elsewhere. this list is so high-traffic already. if as a fledgling newbie i've overstepped any bounds, my apologies. tia, ken On Wed, 2 Jan 2002, Brett W. McCoy wrote: > On Wed, 2 Jan 2002, Maciejewski, Thomas wrote: > > > not to get flam

RE: C vs. Perl

2002-01-02 Thread Hanson, Robert
I don't deal with IPC, so I can't give you an example off the top of my head. The perlfork manpage has a bunch of info though depending on what you want to do, and there are probably a bunch of modules out there as well to simplify the process. I used one of those modules a long time ago when I

RE: C vs. Perl

2002-01-02 Thread Maciejewski, Thomas
I am actually programming perl for work and am trying to learn it ... -Original Message- From: Brett W. McCoy [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 02, 2002 2:22 PM To: Maciejewski, Thomas Cc: 'Bob Showalter'; [EMAIL PROTECTED] Subject: RE: C vs. Perl On Wed, 2 Jan 2002

RE: C vs. Perl

2002-01-02 Thread Maciejewski, Thomas
heh ... again though in large groups ... this becomes a bit of a problem since you all have to kind of be in sync with coding styles and courteous coding I have seem cryptic java code ... but that is often from variables name temp,a,b,a1,b1 etc ... -Original Message- From: Hanson, Rob

RE: C vs. Perl

2002-01-02 Thread Brett W. McCoy
On Wed, 2 Jan 2002, Maciejewski, Thomas wrote: > not to get flamed here but one of the reasons I dont like perl is that > there are sometimes too many ways to do something ... and all of them > are fairly cryptic ... people having different coding styles can really > confuse the hell out of some

RE: compare between two arrays

2002-01-02 Thread Mike Rapuano
from the perl FAQ: @array1 = (1..10); @array2 = (5..15); @union = @intersection = @difference = (); %count = (); foreach $element (@array1, @array2) { $count{$element}++ } foreach $element (keys %count) { push @union, $element; push @{ $count{$element} > 1 ? \@in

RE: C vs. Perl

2002-01-02 Thread Hanson, Robert
No flames from me. One of Perl's strong/weak points is that there are too many ways to do something... I agree with that. But it is up to the programmer to implement solutions that make sense and are easy to maintain. I personally like having the power to do what I need to do, which makes it my

RE: C vs. Perl

2002-01-02 Thread Maciejewski, Thomas
agreed 100% ... but I think that perl lends itself to cryptic code where java lends itself to order ... which is agreed is limiting in some aspects -Original Message- From: Brett W. McCoy [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 02, 2002 2:08 PM To: Maciejewski, Thomas Cc: Ag

compare between two arrays

2002-01-02 Thread Nisim, Amit
Hi All, I want to compare between two arrays. How can I do it ? One way I know is : $a = (join " ",@a); $b = (join " ",@b); if ($b eq $a) { print "equal";} I am looking for better way. thanks amit -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTE

RE: C vs. Perl

2002-01-02 Thread Maciejewski, Thomas
how ? through CGI? can you post an example? -Original Message- From: Hanson, Robert [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 02, 2002 2:09 PM To: Maciejewski, Thomas; Agustin Rivera; [EMAIL PROTECTED] Subject: RE: C vs. Perl "One benifit to running java though ... is that

RE: C vs. Perl

2002-01-02 Thread Brett W. McCoy
On Wed, 2 Jan 2002, Maciejewski, Thomas wrote: > agreed that OO isnt always better but the point that I was trying to make > was that I would rather build more structured code that is easier to > maintain / debug than to worry about the internal speed of a program ... > also wanted to point out t

RE: C vs. Perl

2002-01-02 Thread Hanson, Robert
"One benifit to running java though ... is that you can easily share information between your threads" Same with Perl. Rob -Original Message- From: Maciejewski, Thomas [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 02, 2002 2:02 PM To: 'Brett W. McCoy' Cc: Agustin Rivera; [EMAIL P

RE: C vs. Perl

2002-01-02 Thread Maciejewski, Thomas
not to get flamed here but one of the reasons I dont like perl is that there are sometimes too many ways to do something ... and all of them are fairly cryptic ... people having different coding styles can really confuse the hell out of someone else that is trying to do some work with the code.

RE: C vs. Perl

2002-01-02 Thread Hanson, Robert
But then again Perl is OO if you want it to be, Perl supports fork for spawning processes (better support in Unix than in Windows though), and the original poster was running mod_perl so subsequent hits to a script are run from already compiled code cached in memory. So I don't see that porting t

RE: C vs. Perl

2002-01-02 Thread Maciejewski, Thomas
agreed that OO isnt always better but the point that I was trying to make was that I would rather build more structured code that is easier to maintain / debug than to worry about the internal speed of a program ... also wanted to point out that there are other aspects to the percieved speed of a

RE: C vs. Perl

2002-01-02 Thread Bob Showalter
> -Original Message- > From: Maciejewski, Thomas [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, January 02, 2002 1:44 PM > To: 'Brett W. McCoy'; Agustin Rivera > Cc: [EMAIL PROTECTED] > Subject: RE: C vs. Perl > > > how about all of the issues involved with spawning off processes ... >

RE: C vs. Perl

2002-01-02 Thread Brett W. McCoy
On Wed, 2 Jan 2002, Maciejewski, Thomas wrote: > how about all of the issues involved with spawning off processes ... > > in java servlets I know this is handled because the servlet is always > running ... You mean the servlet container is always running, like Tomcat. > you may end up with a mo

RE: C vs. Perl

2002-01-02 Thread Maciejewski, Thomas
you may want to move to servlets also since servlets (round trip and depending on the ammont of processing going on) should run faster than perl or c cgis -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 02, 2002 12:35 PM To: [EMAIL PROTECT

RE: C vs. Perl

2002-01-02 Thread Maciejewski, Thomas
how about all of the issues involved with spawning off processes ... in java servlets I know this is handled because the servlet is always running ... you may end up with a more efficient system and easier to debug code and all of the other benifits from OO ... pretty much all around better by

Re: C vs. Perl

2002-01-02 Thread Brett W. McCoy
On Wed, 2 Jan 2002, Agustin Rivera wrote: > Ok, the local Linux guru has proclaimed that C would be faster than Perl. I > know C is very effecient so I don't really doubt him, but my question is > would it make that much of a difference? I certainly wouldn't mind learning > C, the only ques

Re: Parsing large text files

2002-01-02 Thread Adriano Rodrigues Ferreira
If the file is too large, don't create a list of lines in memory. You may have problems if you do it. Instead, do open(NEWQUOTES,"newquotes.txt"); open(OTHERFILE,">otherfile.txt"); while ($line=) { chomp $line; my @fields = map { $_ .= " " x (255-length($_)) } split(/,/,$line);

Re: C vs. Perl

2002-01-02 Thread GoodleafJ
I personally think if you have working, secure scripts in Perl, and are accustomed to maintaining them, then it is not worthwhile to port to C. While it is faster, I think the time spent fussing with the porting, etc is not worth it. If you really, really need more speed, I would suggest that thr

Re: C vs. Perl

2002-01-02 Thread Curtis Poe
--- Agustin Rivera <[EMAIL PROTECTED]> wrote: > Ok, the local Linux guru has proclaimed that C would be faster than Perl. I > know C is very effecient so I don't really doubt him, but my question is > would it make that much of a difference? I certainly wouldn't mind learning > C, the only q

RE: C vs. Perl

2002-01-02 Thread Hanson, Robert
Unless you have a specific script that uses a lot of CPU cycles, then I doubt you will see substantial benefit. C is the obvious choice for image manipulation and parsing structured data like XML. ...But since that is the case you will notice that most of these functions can be accomplished usin

RE: C vs. Perl

2002-01-02 Thread Maciejewski, Thomas
this is the ole flame war argument ... the basis of this in my opinion is what do you need to be faster? I would rather look for bottlenecks and optimize them than to optimize everything depending on what you are doing C could be much faster I am of the mindset to have clearer code and code

Re: Question for those familiar with imagemagick for perl

2002-01-02 Thread Randal L. Schwartz
> "Zentara" == Zentara <[EMAIL PROTECTED]> writes: Zentara> I found it in the demos for the Perl-magick module. I have this theory that nobody ever codes PerlMagick from the docs, which put plainly, suck. Everyone always starts with some example in the demos, and then mutates it slowly, va

C vs. Perl

2002-01-02 Thread Agustin Rivera
Ok, the local Linux guru has proclaimed that C would be faster than Perl. I know C is very effecient so I don't really doubt him, but my question is would it make that much of a difference? I certainly wouldn't mind learning C, the only question is would be worth the time to port our Perl sc

RE: Nested IF

2002-01-02 Thread Hanson, Robert
>> print "$tline[$i]; You are missing a quote on all 3 of these lines, it should be: print "$tline[$i]"; But there is probably no reason to have a single variable in quotes alone, so I recommend this: print $tline[$i]; Rob -Original Message- From: Michael Simmons [mailto:[EMAIL P

Nested IF

2002-01-02 Thread Michael Simmons
Does anyone see what the problem with this is? if ( $tline[$i] =~ /^$name\s/ ) { if ( $tline[$i] =~ /\scname\s/ ) { print "Found the following alias: \n"; print "$tline[$i]; } elsif ( $tline[$i] =~ /\sa\s/ ) { p

RE: Parsing large text files

2002-01-02 Thread Scott
Ok, do you recommend I open the file and create a list of the lines in that file? Example below on how I did the comma seperate list: open(QUOTE2,"$QuoteFile"); open(NEWQUOTES, ">>newquotes.txt"); while ($line = ) { $line =~s/\t/,/g; print NEWQUOTES "$line"; } close (NEWQUOTE

RE: Parsing large text files

2002-01-02 Thread Scott
Rob: That's me -- overthinking things again! Thank you, I am going to work on this now. -Scott On Wed, 2 Jan 2002, Hanson, Robert wrote: > You could do something like this (including the comma delimeter)... > > # a sample record > my $record = "blah1\tblah2\tblah3"; > > # split by tab

RE: Parsing large text files

2002-01-02 Thread Hanson, Robert
You could do something like this (including the comma delimeter)... # a sample record my $record = "blah1\tblah2\tblah3"; # split by tabs my @fields = split( /\t/, $record ); for (my $i = 0; $i < @fields; $i++ ) { # add 255 spaces to the field $fields[$i] .= " " x 255;

Re: Question for those using gd.pm

2002-01-02 Thread Shawn
Hey Joel, Here is a script I made a couple of years back where I DID use another font... Shawn #!perl -w use GD; use GD::Text::Wrap; &make_message; exit; sub make_message { open(PNG,"button.png") or die print "Can't open button.png: $!\n"; $map=newFromPng GD::Image(PNG) or die print "C

Parsing large text files

2002-01-02 Thread Scott
Hi: I am developing a input routine in perl that will take a SQL exported file in tab delimited format and convert it to something that our mainframe can process. The file will ultimately have 255 characters for each field. I have been successful in replacing the tabs with comma's, but now

Re: Question for those familiar with imagemagick for perl

2002-01-02 Thread zentara
On Tue, 1 Jan 2002 23:03:42 EST, [EMAIL PROTECTED] wrote: >The problem? After I created a working script where it creates 'button.png' >and views it, I try to add text to it, and no changes take affect. Without >that one line that adds text (Or should) the script is perfect. I don't want >it ch

RE: redirect to URL[linux,apache]

2002-01-02 Thread Bob Showalter
> -Original Message- > From: KeN ClarK [mailto:[EMAIL PROTECTED]] > Sent: Sunday, December 30, 2001 9:25 PM > To: [EMAIL PROTECTED] > Subject: redirect to URL[linux,apache] > > > 1. I'm VERY new. > 2. I have the Perl Cookbook & Learning Perl. > 3. I can't figure this out, and searches on

Re: Extracting Titles from a bunch of HTML files

2002-01-02 Thread Randal L. Schwartz
> "Richard" == Richard S Crawford <[EMAIL PROTECTED]> writes: Richard> I have a directory containing over 250 HTML files. What is the best Richard> way to extract the title (between the and tags) of Richard> each file without having to open the file and read in the contents, Richard> which

RE: open URL as stream with LWP?

2002-01-02 Thread Bob Showalter
> -Original Message- > From: Steven Bach [mailto:[EMAIL PROTECTED]] > Sent: Saturday, December 29, 2001 7:28 PM > To: [EMAIL PROTECTED] > Subject: open URL as stream with LWP? > > > Is there a way to open a URL with LWP so that it becomes > something like > a filehandle so that I can d

RE: samba

2002-01-02 Thread Mariana Añez
HAPPY NEW YEAR EVERYONE First you must do a kernel compilation adding NTFS as a file system Second you have to add the NTFS device in the SAMBA configuration file. -Original Message- From: nafiseh saberi [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 01, 2002 2:09 AM To: [EMA

Re: add text to the end of a word. HELP!!

2002-01-02 Thread John W. Krahn
Ahmed Moustafa wrote: > > I've tested reading and writing from the same file and it didn't work. I > think that can't be done in any language. Like I posted on Monday. :-) perl -pli -e's/$/\@minime.com/' yourfile.txt Also, read the entry for open() in the perlfunc document and the perlopent

Re: URL-encoding strings

2002-01-02 Thread John W. Krahn
Rory O'Connor wrote: > > Is there any way to automatically URL-encode strings with Perl? > MSIE does this automatically, but I noticed that Konqueror does not. Maybe one of these will help. http://search.cpan.org/search?mode=module&query=url John -- use Perl; program fulfillment -- To unsu

SAMBA

2002-01-02 Thread nafiseh saberi
hi dear team... happy new year...:)) do you have more info about SAMBA and how I can use it ?? thx. Sincerely yours Nafiseh Saberi People will forget what you said ... People will forget what you did... But people will Never Forget how you made them fee

Re: Extracting Titles from a bunch of HTML files

2002-01-02 Thread John W. Krahn
"Richard S. Crawford" wrote: > > I have a directory containing over 250 HTML files. What is the best way to > extract the title (between the and tags) of each file > without having to open the file and read in the contents, which seems like > it would be very slow? The only way you can read t

RE: add text to the end of a word. HELP!!

2002-01-02 Thread John Edwards
You need to open the file, save the contents in memory, then close the file. Now re-open the file for writing and print the saved contents to it making the changes as needed. This is fine for non crictical files that are small (once you open the file for write, it's contents are deleted so if your

URL-encoding strings

2002-01-02 Thread ROry O'Connor
Is there any way to automatically URL-encode strings with Perl? MSIE does this automatically, but I noticed that Konqueror does not. Thanks! Rory -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: add text to the end of a word. HELP!!

2002-01-02 Thread Ahmed Moustafa
Leon, I've tested reading and writing from the same file and it didn't work. I think that can't be done in any language. Leon wrote: > - Original Message - > From: "Ahmed Moustafa" <[EMAIL PROTECTED]> > Newsgroups: perl.beginners > To: "Leon" <[EMAIL PROTECTED]> > Cc: <[EMAIL PROTECT

Extracting Titles from a bunch of HTML files

2002-01-02 Thread Richard S. Crawford
I have a directory containing over 250 HTML files. What is the best way to extract the title (between the and tags) of each file without having to open the file and read in the contents, which seems like it would be very slow? Sliante, Richard S. Crawford http://www.mossroot.com AIM: Buff

Re: Line Parsing/Splitting

2002-01-02 Thread John W. Krahn
"Hubert Ian M. Tabug" wrote: > > Given that $a = `1234 abcde abdcd acbd`; ^ ^ So you are running the program "1234" and want the output in $a or are the back-quotes a typo? > Would anyone know of of a way for me to just > "extract" the numerical

  1   2   >