Re: performance of splice v. split

2003-03-14 Thread Ramprasad
Serge Shakarian wrote: When parsing a large log file which one would be better for performance splice or split? Every line is in a standard format and I would be using splice/split to get 12 out of 20 space separeted words in each line. Thanks in advance. Serge splice is used on arrays and split

Re: why does sysopen fails to create a file?

2003-03-14 Thread R. Joseph Newton
Erwin Zavala wrote: > It is failing at line 5 .. and the error message is: Joseph -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

performance of splice v. split

2003-03-14 Thread SHAKARIAN,SERGE (HP-NewJersey,ex1)
When parsing a large log file which one would be better for performance splice or split? Every line is in a standard format and I would be using splice/split to get 12 out of 20 space separeted words in each line. Thanks in advance. Serge

why does sysopen fails to create a file?

2003-03-14 Thread Erwin Zavala
It is failing at line 5 #!/user/bin/perl $path1 = "export.txt"; $path2 = "export3.txt"; sysopen(openFile, $path1, O_RDONLY) || die $!; sysopen(writeFile, $path2, O_WRONLY | O_CREAT ) || die $!; while() { print writeFile $1, $2 ,"n\n" if m/(\w+\s)(\w+\s)/; } __

Re: $date in printf

2003-03-14 Thread John W. Krahn
Patricia E Gorden-Ozgul wrote: > > I need help with my $date var. I want it to print at the sixth printf > position. Can someone help? > > Input: > 18033|18033|89.00|1|182682|20021011|89.00|1|0|070001|19724|FIRM| > 03046|03046|135.93|1|67579558|20020927|135.93|1|0|070097|90081|FIRM| > 0

Re: Re: apache error

2003-03-14 Thread Etienne Rivard
-Original Message- From: "R. Joseph Newton" <[EMAIL PROTECTED]> To: Francesco del Vecchio <[EMAIL PROTECTED]> Date: Fri, 14 Mar 2003 13:45:08 -0800 Subject: Re: apache error Francesco del Vecchio wrote: > I'm new to apache and linux. > > I'm trying to run the "Hello World" cgi that work

Re: When to use ( and when to use ((?

2003-03-14 Thread John W. Krahn
Michael Weber wrote: > > I'm just not getting it. > > When do you use ( in a statement, when do you need to use ((, and is > the space after either or both mandatory? > > For example, I coded this statement: > > if (( $_ eq $bad_guys_ip )) { more_stuff_here }; > > Why the two (( in an if? And

Re: Help with Threads.

2003-03-14 Thread Sharmarke Aden
I'm a C++/Java developer so Perl is all new to me (laziness on my part I guess since it seems so popular with folks around here :). I have taken the advise of many in here and have solved my problem (thanks everyone). BTW: I'm using Win 2K Advanced Server machine. "R. Joseph Newton" <[EMAIL PROT

Re: When to use ( and when to use ((?

2003-03-14 Thread Rob Dixon
Michael Weber wrote: > I'm just not getting it. > > When do you use ( in a statement, when do you need to use ((, and is > the space after either or both mandatory? > > For example, I coded this statement: > > if (( $_ eq $bad_guys_ip )) { more_stuff_here }; > > Why the two (( in an if? And why do

RE: When to use ( and when to use ((?

2003-03-14 Thread Bakken, Luke
> I'm just not getting it. > > When do you use ( in a statement, when do you need to use ((, and is > the space after either or both mandatory? > > For example, I coded this statement: > > if (( $_ eq $bad_guys_ip )) { more_stuff_here }; (( )) is ksh integer test syntax, and has nothing to do w

When to use ( and when to use ((?

2003-03-14 Thread Michael Weber
I'm just not getting it. When do you use ( in a statement, when do you need to use ((, and is the space after either or both mandatory? For example, I coded this statement: if (( $_ eq $bad_guys_ip )) { more_stuff_here }; Why the two (( in an if? And why does it seem to not work when I miss th

Re: CONSTANTS in Perl

2003-03-14 Thread Rob Dixon
Tony Esposito wrote: > In C, you can define a constants - "variables" whose contents can not > be changed. > Is there any way to do this in Perl? There are some variables I use > that I would love to set as a constant. > Hi Tony. Try this: use constant BUFFER_LENGTH => 64; more documentatio

Re: $date in printf

2003-03-14 Thread Rob Dixon
#x27;time' to get the current date. my $date = do { my @ymd = (localtime(time))[5,4,3]; $ymd[0] += 1900; $ymd[1] += 1; sprintf "%04d%042%02d", @ymd; }; which currently gives a value of '20030314'. But do you mean that want it to print

CONSTANTS in Perl

2003-03-14 Thread Tony Esposito
In C, you can define a constants - "variables" whose contents can not be changed. Is there any way to do this in Perl? There are some variables I use that I would love to set as a constant. Thanks. > Anthony (Tony) Esposito > Senior Technical Consultant > Inovis(tm), formerly Harbinger

RE: Slightly OT

2003-03-14 Thread David Olbersen
Outstanding, exactly what I was looking for. Thank you very much! -- David Olbersen iGuard Engineer 11415 West Bernardo Court San Diego, CA 92127 1-858-676-2277 x2152 > -Original Message- > From: R. Joseph Newton [mailto:[EMAIL PROTECTED] > Sent: Friday, March

Re: Slightly OT

2003-03-14 Thread R. Joseph Newton
David Olbersen wrote: > I'm writing a script that will be (among other things) decoding email attachments > using MIME::Decoder. > > I plan on limiting the maximum attachment size to some limit. > > Does anybody know where I can find the size differences between the encoded and > decoded file? >

Re: Help with Threads.

2003-03-14 Thread R. Joseph Newton
Sharmarke Aden wrote: Hi Sharmarke, > I'm new to Perl and trying to access several directories at the same time > and simply read the content of the directory and do some processing on the > files in those directories. The code below is a reference code to get > started on the real work. The cod

$date in printf

2003-03-14 Thread Gorden-Ozgul, Patricia E
I need help with my $date var. I want it to print at the sixth printf position. Can someone help? Pat Gorden-Ozgul [EMAIL PROTECTED] Input: 18033|18033|89.00|1|182682|20021011|89.00|1|0|070001|19724|FIRM| 03046|03046|135.93|1|67579558|20020927|135.93|1|0|070097|90081|FIRM| 08830|08830|

Re: apache error

2003-03-14 Thread R. Joseph Newton
Francesco del Vecchio wrote: > I'm new to apache and linux. > > I'm trying to run the "Hello World" cgi that works perfectly from terminal but via > WebServer I > obtain this error: > > [Fri Mar 14 17:03:11 2003] [error] [client 127.0.0.1] Premature end of script > headers: hello.pl > > Do you h

Re: Help with Threads.

2003-03-14 Thread Sharmarke Aden
I've made the changes you have sugessted but i still get the "Free to wrong pool 1a49800 not 15d26e8 during global destruction." error. P.S. bellow you'll find the code with the chnages you've sugessted. #start code use threads; use warnings; use strict; use Cwd; my $currDir = `cd`; chop($currD

Re: apache error

2003-03-14 Thread R. Joseph Newton
Bob Showalter wrote: > R. Joseph Newton wrote: > > What system needs those "\r"s? I have yet to run across a > > web browser thaqt did not respond properly with simple newlines: "\n". > > They are required per RFC2616, and they are output by CGI.pm. But the RFC > encourages clients to be forgivi

Re: Help with Threads.

2003-03-14 Thread John W. Krahn
Sharmarke Aden wrote: > > I'm new to Perl and trying to access several directories at the same time > and simply read the content of the directory and do some processing on the > files in those directories. The code below is a reference code to get > started on the real work. The code below howeve

RE: apache error

2003-03-14 Thread Ramón Chávez
Be sure you are using the correct path to PERL on your system. #!/usr/bin/perl or #!/usr/local/bin/perl -rm- - Original Message - From: Francesco del Vecchio <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, March 14, 2003 10:58 AM Subject: RE: apache error > Sorry for boring

Re: Help with Threads.

2003-03-14 Thread Sharmarke Aden
I upgraded to perl 5.8 and I still get an error. Here is the error I get for the code mentioned in my previous message: "Free to wrong pool 1af0140 not 15d26e8 during global destruction." "Rob Hanson" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Maybe you could post the error to

RE: apache error

2003-03-14 Thread Bob Showalter
Francesco del Vecchio wrote: > Sorry for boring you, but even copying and pasting the source > you gave me I obtain the same error > :-(( > > Any help? Sorry, dunno. I just cut and pasted all three examples back onto my system and all work correctly. Look in the error log below the "Premature en

RE: apache error

2003-03-14 Thread Bob Showalter
R. Joseph Newton wrote: > Bob Showalter wrote: > > > A CGI script needs to output a MIME header. At a bare minimum, you > > need to add the following: > > > >print "Content-Type: text/plain\r\n\r\n", > >"ciao\n"; > > Hi Bob, Hi R. Joseph, > > What system needs those "\r"s? I hav

Theards and File/Directory access help

2003-03-14 Thread Sharmarke Aden
I'm new to Perl and trying to access several directories at the same time and simply read the content of the director and do some processing on the files in those directories. The code below is a reference code to get started on the real work. The code below however crashes and I'm lost as to what

RE: Help with Threads.

2003-03-14 Thread Hanson, Rob
Maybe you could post the error to the list? The problem may be the version of Perl you are using. Stable threads were introduced in version 5.8. In 5.6 they are experimental (maybe part of the problem?) and use a different syntax. You seem to be using "use thread" which is the 5.8 syntax, but 5

Slightly OT

2003-03-14 Thread David Olbersen
I'm writing a script that will be (among other things) decoding email attachments using MIME::Decoder. I plan on limiting the maximum attachment size to some limit. Does anybody know where I can find the size differences between the encoded and decoded file? That is to say, does the base64 en

Help with Threads.

2003-03-14 Thread Sharmarke Aden
I'm new to Perl and trying to access several directories at the same time and simply read the content of the directory and do some processing on the files in those directories. The code below is a reference code to get started on the real work. The code below however crashes and I'm lost as to what

Re: How to map hash keys only, not values?

2003-03-14 Thread R. Joseph Newton
[EMAIL PROTECTED] wrote: > Hi Joseph, > > >Probably just as well. Is there some context where you anticipate having > to repair broken keys after the fact? > > In this case I'm building packages, and don't want to count on the user to > get the case of the text correct when passing the values. L

Re: apache error

2003-03-14 Thread R. Joseph Newton
Francesco del Vecchio wrote: > Sorry for boring you, but even copying and pasting the source you gave me I obtain > the same error > :-(( > > Any help? > > Francesco Get rid of the "\r"s. Dont try to do too many things at once. Just print the header fist, on one line. That is one job. Then be

Re: How to map hash keys only, not values?

2003-03-14 Thread Peter_Farrar
Hi Joseph, >Probably just as well. Is there some context where you anticipate having to repair broken keys after the fact? In this case I'm building packages, and don't want to count on the user to get the case of the text correct when passing the values. So if I need to set the 'smile' attrib

Re: apache error

2003-03-14 Thread R. Joseph Newton
Bob Showalter wrote: > A CGI script needs to output a MIME header. At a bare minimum, you need to > add the following: > >print "Content-Type: text/plain\r\n\r\n", >"ciao\n"; Hi Bob, What system needs those "\r"s? I have yet to run across a web browser thaqt did not respond properl

Re: Is there a quicker way to do this

2003-03-14 Thread Aimal
Hello, Mr. Wagner, you are right, some keys in hashA are not in hashB, this means the perl from the previous step also needs debugging or I have some spurious data. This would explain why when I used 'if defined' in addition to, what Mr. Dixon suggested, and which is what Mr. Bakken is now sugg

RE: apache error

2003-03-14 Thread Francesco del Vecchio
Sorry for boring you, but even copying and pasting the source you gave me I obtain the same error :-(( Any help? Francesco --- Bob Showalter <[EMAIL PROTECTED]> wrote: > Francesco del Vecchio wrote: > > I'm new to apache and linux. > > > > I'm trying to run the "Hello World" cgi that works perf

RE: Is there a quicker way to do this

2003-03-14 Thread Bakken, Luke
> Use of uninitialized value in hash element at prepare.pl 83. > Use of uninitialized value in concatenation (.) or string at > prepare.pl > line 83. > >foreach my $keyA (keys hashA) { > my $keyB = $hashC{$keyA}; > print "$keyA\n$hashA{keyA}\n\n$keyB\n$hashB{keyB}" > } This

RE: apache error

2003-03-14 Thread Ramón Chávez
#!/usr/bin/perl -w print "content-type: text/html \n\n"; print "\n"; print "ciao\n"; print "\n; - Don't forget you need to print the header: print "content-type: text/html \n\n"; -rm- - Original Message - From: Francesco del Vecchio <[EMAIL PROT

RE: Is there a quicker way to do this

2003-03-14 Thread Wagner, David --- Senior Programmer Analyst --- WGO
Aimal wrote: > Hi, > > Thanks for your help, it seems to be doing the job and in a fraction > of the time. You are right about the keys and values being the same- > that was an error, the hash is arranged as you have said ( '12345' => > '67890'). There seems to be a slight error, the following err

Re: Is there a quicker way to do this

2003-03-14 Thread Aimal
Hi, Thanks for your help, it seems to be doing the job and in a fraction of the time. You are right about the keys and values being the same- that was an error, the hash is arranged as you have said ( '12345' => '67890'). There seems to be a slight error, the following error messages appear on num

RE: apache error

2003-03-14 Thread Bob Showalter
Francesco del Vecchio wrote: > I'm new to apache and linux. > > I'm trying to run the "Hello World" cgi that works perfectly > from terminal but via WebServer I > obtain this error: > > [Fri Mar 14 17:03:11 2003] [error] [client 127.0.0.1] > Premature end of script headers: hello.pl > > Do you h

Re: apache error

2003-03-14 Thread Francesco del Vecchio
Tnx for the example! now I undersand! ^_^ Tnx to David too!!! Francesco --- Pete Emerson <[EMAIL PROTECTED]> wrote: > The CGI module is fantastic for doing things like printing headers, > parsing forms, etc. I don't think I've written a CGI script without it. > Your missing the header. See 'pe

RE: apache error

2003-03-14 Thread Francesco del Vecchio
sorry David, can you post an "hello world" cgi working? I was using INDIGO PERL on win and that script work on that system. Francesco --- David Olbersen <[EMAIL PROTECTED]> wrote: > Francesco, > > That's not a complete CGI script -- it's missing quite a few headers. > > I'd suggest reading u

Re: apache error

2003-03-14 Thread Pete Emerson
The CGI module is fantastic for doing things like printing headers, parsing forms, etc. I don't think I've written a CGI script without it. Your missing the header. See 'perldoc CGI'. #!/usr/bin/perl -w use strict; # Highly recommended! use CGI qw(:standard); print header; print start_html; pr

RE: apache error

2003-03-14 Thread David Olbersen
Francesco, That's not a complete CGI script -- it's missing quite a few headers. I'd suggest reading up on the CGI module. You can get information about it at http://search.cpan.org. To be fair this has very little to do with apache, and quite a bit to do with your script.

apache error

2003-03-14 Thread Francesco del Vecchio
I'm new to apache and linux. I'm trying to run the "Hello World" cgi that works perfectly from terminal but via WebServer I obtain this error: [Fri Mar 14 17:03:11 2003] [error] [client 127.0.0.1] Premature end of script headers: hello.pl Do you have any idea about it? the source is the follo

Compiling Perl?

2003-03-14 Thread Jefferies, Brian
Is there a general consensus regarding compiling perl into binary executable? I love perl, but I don't understand the sense in re-compiling the same cgi script (for example) 10,000 times a day. I have read and tested "perlcc -b" and found no performance improvement over running the .pl.

Re: Is there a quicker way to do this

2003-03-14 Thread Rob Dixon
Aimal Pashtoonmal wrote: > Hello, > > I am about to finish a perl script but it takes very long to run as I > am using three foreach loops one after the other. I have three files > with data passed into hashes: > > FileA keyA = 12345 > valueA = abcdefgh > > FileB keyB = 67890 >

RE: hide password on sign-in

2003-03-14 Thread Bob Showalter
[EMAIL PROTECTED] wrote: > How do I perform subject above? [EMAIL PROTECTED] Does the FAQ article: perldoc -q 'How do I ask the user for a password?' answer your question? If not, you need to provide more details. Sign-in to what? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional

RE: String manipulation problem

2003-03-14 Thread rbraswell
Thanks to everyone for the help. The various responses to my question showed me that the perl creed is not idle chatter. There truly is "more than one way to do it!" Thanks to all, Ryan -Original Message- From: Rob Dixon [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 12, 2003 5:36 PM To

RE: Is there a quicker way to do this

2003-03-14 Thread Aimal Pashtoonmal
Hello, I am about to finish a perl script but it takes very long to run as I am using three foreach loops one after the other. I have three files with data passed into hashes: FileA keyA = 12345 valueA = abcdefgh FileB keyB = 67890 valueB = ijklmno FileC keyC = 12345:67890 (

Re: Appending to a string

2003-03-14 Thread deb
Doh, you're sooo right. Thanks, d John W. Krahn <[EMAIL PROTECTED]> had this to say, > Deb wrote: > > > > Wait. Using this construct, I can't seem to get the change to write out to > > the file, like I can to stdout. > > > > > > while () { > > > if ( /^That_Text\s=\s2/ ) { > > >

RE: Schedule::Cron

2003-03-14 Thread Bob Showalter
Heidi Ng wrote: > Hi, > > I just found out about this Cron.pm module in Perl and would like to > use it to schedule to run my perl scripts (I think the syntax is > right.. I was hoping to run it to see what it does.) Anyway, I > installed Cron.pm v1.5 and was trying to run the following script. >

RE: s// is deletng my entries

2003-03-14 Thread Bob Showalter
Erwin Zavala wrote: > My export.txt file has data in the format > > Joe Doe mail: [EMAIL PROTECTED] > > I want my script to replace mail for email. At the end of the script > I get an empty file? Why what am i doing wrong > > #!/user/bin/perl > > open(openFile, " open(writeFile, ">export.txt")

hide password on sign-in

2003-03-14 Thread HERB1911
How do I perform subject above? [EMAIL PROTECTED]

Re: Function to pass a variable to numeric value

2003-03-14 Thread Rob Dixon
Hi Ruben Ruben Montes wrote: > Hello, > I'm working with Net::SNMP and I need to consult an OID. The last > number of the OID is a variable and I want to make a get of this OID, > but the debugger says it's not a numeric value... > > $i=1 > while($i<4){ > my $descr ='1.3.6.1.2.1.2.2.1.2.($i)'; > .

Re: s// is deletng my entries

2003-03-14 Thread Rob Dixon
Erwin Zavala wrote: > My export.txt file has data in the format > > Joe Doe mail: [EMAIL PROTECTED] > > I want my script to replace mail for email. At the end of the script > I get an empty file? Why what am i doing wrong > > #!/user/bin/perl > > open(openFile, " open(writeFile, ">export.txt"); >

Re: help with a date.

2003-03-14 Thread Janek Schleicher
Christopher M Burger wrote at Thu, 13 Mar 2003 22:31:24 -0500: > I was wondering if anyone could help me. Here is my question. > > I have a date 03242003 I want it to look like 03/24/2003 how do I do that? > As TMTWTDI, here's a solution with regexes: $data =~ s,(..)(..)(),$1/$2/$3,; Be

Re: Appending to a string

2003-03-14 Thread Rob Dixon
Deb wrote: > > Wait. Using this construct, I can't seem to get the change to write > out to the file, like I can to stdout. > [snip] > > Here's my code. > > sub editConfSettings { > > open (IN, "tmpconf") or die "cannot open for reading: $!\n"; > open (OUT, "conf")or die "cannot open for writi

Re: Regular Expressions http error code

2003-03-14 Thread Rob Dixon
Hi Derek. Derek Romeyn wrote: > Using your idea I ended up with data like this. Which is odd because > the database should only include 400 and 500 type errors. > [snip] > > 404 24.54.175.153 - - [11/Mar/2003:07:48:37 -0800] "GET > /e/t/invest/img/spacer.gif HTTP/1.1" 404 0 "https:// > 370

Re: help with a date.

2003-03-14 Thread George P.
On Fri, 14 Mar 2003, John W. Krahn wrote: > Christopher M Burger wrote: > > > > I was wondering if anyone could help me. Here is my question. > > > > I have a date 03242003 I want it to look like 03/24/2003 how do I do that? > > > > Appreciate any help. > > my $date = '03242003'; > > $date = j

Re: help with a date.

2003-03-14 Thread John W. Krahn
Christopher M Burger wrote: > > I was wondering if anyone could help me. Here is my question. > > I have a date 03242003 I want it to look like 03/24/2003 how do I do that? > > Appreciate any help. my $date = '03242003'; $date = join '/', unpack 'a2a2a4', $date; Or: $date =~ s,(?<=\d\d)(\d\d

Re: Function to pass a variable to numeric value

2003-03-14 Thread John W. Krahn
Ruben Montes wrote: > > Hello, Hello, > I'm working with Net::SNMP and I need to consult an OID. The last number of > the OID is a variable and I want to make a get of this OID, but the debugger > says it's not a numeric value... > > $i=1 > while($i<4){ If you want to loop thro

Re: problems extracting a range of lines, reworked

2003-03-14 Thread R. Joseph Newton
Pam Derks wrote: > the program ran as expected > but I did get this error: > Use of uninitialized value at instr_guts.pl line 39, chunk 2. > > here's line 39: > 39if($replace =~ $1){ > .. > here's the sample output: > YES: C. J. S. WALLIA > 1: Instructor: C. J. S. WALLIA > > 2: C. J

Re: problems extracting a range of lines, reworked

2003-03-14 Thread Pam Derks
the program ran as expected but I did get this error: Use of uninitialized value at instr_guts.pl line 39, chunk 2. here's line 39: 39if($replace =~ $1){ one thing I forgot to mention, at the end of every instructor bio in , I added "XXX", so I could mark the end bio. here's the

Function to pass a variable to numeric value

2003-03-14 Thread Ruben Montes
Hello, I'm working with Net::SNMP and I need to consult an OID. The last number of the OID is a variable and I want to make a get of this OID, but the debugger says it's not a numeric value... $i=1 while($i<4){ my $descr ='1.3.6.1.2.1.2.2.1.2.($i)';

help with a date.

2003-03-14 Thread Christopher M Burger
I was wondering if anyone could help me. Here is my question. I have a date 03242003 I want it to look like 03/24/2003 how do I do that? Appreciate any help. Chris -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: problems extracting a range of lines, reworked

2003-03-14 Thread Pam Derks
thanks for help, here's my solution, any further comments are welcomed... thanks, Pam #!/usr/bin/perl -w use strict; #Purpose: replace Instructor: Name with bio from backmatter open(CAT, "catalog.txt") or die ("no IN file: $!"); open(BIOS, "instructor.txt") or die ("no instructor file: $!")

Re: Linux Perl Editor

2003-03-14 Thread Scott R. Godin
Francesco Del Vecchio wrote: > Is there a perl Editor for linux? (except EMACS) > > Francesco Personally I use vim (and gvim under Xfree86) Nice syntax colorization, and the :set cindent smartindent feature does all the fancy indenting for me, which is very nice. you can run vimtutor at the