Re: the only difference is the 'x' after '/g'

2006-03-31 Thread Hans Meier (John Doe)
! Hans [bottom post order:] On Thursday 30 March 2006 05:15 am, Hans Meier (John Doe) wrote: tom arnall am Donnerstag, 30. März 2006 12.36: the following code: my (@main); $_= From a From: b From: c From: d ; @main = /From [^\n]*?\n.*?(From: .*?\n

Re: the only difference is the 'x' after '/g'

2006-03-30 Thread Hans Meier (John Doe)
tom arnall am Donnerstag, 30. März 2006 12.36: the following code: my (@main); $_= From a From: b From: c From: d ; @main = /From [^\n]*?\n.*?(From: .*?\n).*?/gx; print @main; print --\n;

Re: Counting specific elements in a XML object

2006-03-30 Thread Hans Meier (John Doe)
Dave Adams am Donnerstag, 30. März 2006 21.12: If I have a xml file like the following: ?xml version='1.0'? employee nameJohn Doe/name age43/age sexM/sex departmentRecieving/department /employee employee nameBob Gordon/name age50/age

Re: Counting specific elements in a XML object

2006-03-30 Thread Hans Meier (John Doe)
Gavin Bowlby am Donnerstag, 30. März 2006 21.45: How about: cat fn | grep string to be searched for | wc When I posted a cat | grep the first (and last) time, several people got a well known heart attack :-) grep string to be searched for fn | wc as a non-Perl approach to the problem...

Re: Counting specific elements in a XML object

2006-03-30 Thread Hans Meier (John Doe)
Chas Owens am Donnerstag, 30. März 2006 22.35: cat fn | grep string to be searched for | wc [...] grep string to be searched for fn | wc [...] If we are going to pick nits then it should be grep -c employee fn too much work. c employee fn But your alias may be different ;-) Hans --

Re: Counting specific elements in a XML object

2006-03-30 Thread Hans Meier (John Doe)
Bob Showalter am Donnerstag, 30. März 2006 23.32: Chas Owens wrote: If we are going to pick nits then it should be grep -c employee fn Note that grep -c counts matching *lines*. There is no formal requirement that these elements appear on separate lines. Dave, my first one-liner

Re: counting scalar array elements question

2006-03-09 Thread Hans Meier (John Doe)
John W. Krahn am Donnerstag, 9. März 2006 03.36: Hans Meier (John Doe) wrote: [...] my @array; #or: my @array=(); [v--- this sidenote is wrong] (sidenote: the second form must be used in contexts where the code is persistent/preloaded and used several times, to ensure that @array

Re: Does this script have the efficiency problems?

2006-03-09 Thread Hans Meier (John Doe)
Practical Perl am Donnerstag, 9. März 2006 09.50: Hello, I have a script,which run well at most time.This day I use it to analyse the files of 1.7G,it become very slow and can't get executed continuely anymore.When I run 'strace -p ' (here is this script's PID),there is no output,it

[OT] sanitize/sanitise ? [was: [regexp] Speaking of the /s modifier...]

2006-03-08 Thread Hans Meier (John Doe)
Adam W am Mittwoch, 8. März 2006 02.10: Hans Meier (John Doe) wrote: Adam W am Mittwoch, 8. März 2006 00.49: Sorry, I'm relatively new to programming in general (perl is my first programming language), so I'm not sure what you mean by sanitizing. Could also be sanitising, saw both

Re: multistring replacement

2006-03-08 Thread Hans Meier (John Doe)
Eugeny Altshuler am Mittwoch, 8. März 2006 11.35: Hello! I have such problem, I need to make multistring replacement... How can I do this? I tried to make perl script which acquires file form STDIN and prints result into STDOUT cat file.html | ./myscript That's one way to pass the file

Re: counting scalar array elements question

2006-03-08 Thread Hans Meier (John Doe)
From: Graeme McLaren [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 08, 2006 3:57 PM To: beginners@perl.org Subject: counting scalar array elements question Hi all, I have an array question: If I have a variable, $var, and it contains an array how would I be able to easily

Re: Directory issue

2006-03-07 Thread Hans Meier (John Doe)
DiGregorio, Dave am Dienstag, 7. März 2006 19.30: Ok, I am trying to run another perl script from a perl script and have had little luck in doing so. The main script is in one directory and the one it is controlling is in another directory. the main script starts and calls the other script

Re: [regexp] Speaking of the /s modifier...

2006-03-07 Thread Hans Meier (John Doe)
Adam W am Dienstag, 7. März 2006 23.16: Hans Meier (John Doe) wrote: just to sum up: $test =~ s{ (.*?) \( (.*?) \) } {a href=$2 alt=$2$1/a}xsg; - \( instead of [(]: more readable - no /m modifier : unnecessary without ^/$-anchors - /s : may

[getting OT?] Re: [regexp] Speaking of the /s modifier...

2006-03-07 Thread Hans Meier (John Doe)
JupiterHost.Net am Mittwoch, 8. März 2006 00.29: - \( instead of [(]: more readable not according to best practices Hi JupiterHost.Net I think there are more than one best practices, although not several books carrying this title. I can't - and don't want to - diskuss based on According to

Re: [regexp] Speaking of the /s modifier...

2006-03-07 Thread Hans Meier (John Doe)
Adam W am Mittwoch, 8. März 2006 00.49: Hans Meier (John Doe) wrote: Adam W am Dienstag, 7. März 2006 23.16: Hans Meier (John Doe) wrote: [...] (this dies on empty lines etc. too, and of course the input file's lines should be sanitizes before, and to be on the secure side

Re: How to display database records in a web page !!!!

2006-03-06 Thread Hans Meier (John Doe)
Madhu Kumar am Montag, 6. März 2006 09.57: Hi , Hi Madhu Kumar your problem is not perl, but html related, see below: I want to display database records as web page my database contains some entries and which i wanna write as a report in web page. I have written a code for it which

Re: [regexp] Warnings on Backreferences

2006-03-06 Thread Hans Meier (John Doe)
John W. Krahn am Dienstag, 7. März 2006 00.12: Adam W wrote: JupiterHost.Net wrote: $text =~ s!(.*?)\((.*?)\)!a href=$2 alt=$2$1/a!g; [...] Same exact regex as above: $test =~ s{ (.*?) [(] (.*?) [)] } {a href=$2 alt=$2$1/a}xmsg; [...] Can you tell me what the

Re: problems with logical (and) statement

2006-03-04 Thread Hans Meier (John Doe)
Angus am Freitag, 3. März 2006 17.40: Yes, I did have that typo in my script. I fixed it but I am still never seeing anything print out that says I have a match as the first if control should do. Have you ensured that the compared data structures meet the conditions for a match? The

Re: hash of hashes arrays

2006-03-04 Thread Hans Meier (John Doe)
regatta am Freitag, 3. März 2006 21.29: Good morning/evening everyone, I have a hash of data , this hash is very big with dynamic elements (strings, numbers, hashes, arrays) Here is an example $info{'system'}{'load'}{'1'} $info{'system'}{'load'}{'5'} $info{'system'}{'load'}{'15'}

Re: problems parsing a DHCP.leases file.

2006-02-27 Thread Hans Meier (John Doe)
Angus am Montag, 27. Februar 2006 08.25: Hi all, I am having some problems filling a variable based on the contents of a dhcpd.leases file. All I want at this time is the hostname and ip address. My eventual goal is to create hash of hashes with this information but for now I just want to

Re: alternating bgcolor in rows

2006-02-25 Thread Hans Meier (John Doe)
Bob Showalter am Samstag, 25. Februar 2006 15.03: henry chen wrote: I can't seem to figure out how to alternate the bgcolor for each row that i'm printing from arrayref. Is there a 'foreveryother' function that would allow me to put two lines in the loop? Or is there someway I can put

[rather OT] Re: alternating bgcolor in rows

2006-02-25 Thread Hans Meier (John Doe)
henry chen am Samstag, 25. Februar 2006 07.07: I can't seem to figure out how to alternate the bgcolor for each row that i'm printing from arrayref. Is there a 'foreveryother' function that would allow me to put two lines in the loop? Or is there someway I can put two rows of information and

Re: simple references question

2006-02-24 Thread Hans Meier (John Doe)
Bryan R Harris am Donnerstag, 23. Februar 2006 19.30: Responding to your references to modules, we haven't used them because we can't count on them being there. Obviously my problem, not yours. =) [...] There is no must to have them installed in default locations. You can install them in any

Re: tar command

2006-02-24 Thread Hans Meier (John Doe)
Irfan J Sayed am Freitag, 24. Februar 2006 16.36: Hi All, I need to execute unix tar command thru perl file can somebody helps me out in this regard http://search.cpan.org/~kane/Archive-Tar-1.28/lib/Archive/Tar.pm hth Hans -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional

Re: tar command

2006-02-24 Thread Hans Meier (John Doe)
Irfan J Sayed am Freitag, 24. Februar 2006 19.13: Hi , I already tested with /vobstg.tar in the gzip command but still it's hanging and i am executing this perl script from / partition only. Main thing is that it's creating /vobstg.tar.gz file but not coming to shell prompt or not executing

Re: alternating bgcolor in rows

2006-02-24 Thread Hans Meier (John Doe)
Chas Owens am Samstag, 25. Februar 2006 07.17: [...] Use the module operator (%) with an if statement to do different things in a loop: my $rows = $dbhandle-selectall_arrayref($sql) || die $dbhandle-errstr; if (@$rows) { print centertable border=1 cellspacing=0 cellpadding=3

Re: alternating bgcolor in rows

2006-02-24 Thread Hans Meier (John Doe)
Chas Owens am Samstag, 25. Februar 2006 08.18: [...] Aye, I am an idiot. No, your help on this list is very valuable, and, imho, typos are not proof for idiocy... Hans -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: Extract multiple lines

2006-02-23 Thread Hans Meier (John Doe)
Jack Daniels (Butch) am Donnerstag, 23. Februar 2006 10.30: It's driving me bonkers and can't afford any more psychiatic bills. The data is a saved .txt file when viewing from a website. The vendor will not give us an actual file even though we payed a montly fee for use of the database. I

Re: Extract multiple lines

2006-02-23 Thread Hans Meier (John Doe)
Hans Meier (John Doe) am Donnerstag, 23. Februar 2006 13.07: [...] sorry for replying to myself... The script is only extracting the first line of the heading.. Yes, with every loop trough @lines, you overwrite your variables $title to $dewey. this doesn't matter since you print the contents

Re: simple references question

2006-02-23 Thread Hans Meier (John Doe)
Bryan Harris am Donnerstag, 23. Februar 2006 16.41: Hi Bryan It's a bit lengthy, but I hope it motivates you a bit to look around... You mention larger projects, and I've heard about reusable code... Is that generally done by copy/paste into the script you're working on? Code copiedpasted

Re: Type globs of subroutines?

2006-02-22 Thread Hans Meier (John Doe)
Angerstein am Mittwoch, 22. Februar 2006 11.05: Short Question: Is type globbing of subroutines possible or not? yes, perl -le 'use warnings; use strict; \ sub sub1{1}; \ *sub2=\sub1; \ warn sub2(); \ ' for something like supersub(\smallsub); This (passing a subroutine reference as argument

Re: A problem with apache installation http://localhost issue

2006-02-22 Thread Hans Meier (John Doe)
zhou jian am Mittwoch, 22. Februar 2006 22.40: Hello perl fellows: Hi Paul This is the wrong list for this question (see your subject) but: I encountered a problem when I was installing a perl module. The httpd server related module was hanging overnight when it was trying to test

Re: Why does my inheritance hierarchy get screwed up?

2006-02-22 Thread Hans Meier (John Doe)
Johannes Ernst am Donnerstag, 23. Februar 2006 00.19: [Blogged about it here: http://netmesh.info/jernst/Technical/perl- inheritance-problem.html ] There are three very simple classes in the following code: C is a subclass of B, which is a subclass of A. If I try to instantiate B (see last

Re: simple references question

2006-02-22 Thread Hans Meier (John Doe)
Bryan Harris am Donnerstag, 23. Februar 2006 03.46: Thanks! Regarding your note, out of curiosity, how will it help a lot in the end? I've been scripting for almost 5 years now, and have produced 100 scripts that are used in data analysis work by ~15 people, and have never used use strict,

Re: Error in the if block

2006-02-19 Thread Hans Meier (John Doe)
Ron Smith am Sonntag, 19. Februar 2006 18.47: Hi all, Hi Ron This page accepts a series of numbers, separated by spaces, and gives the values listed bellow. I'm getting the following error, No information about the input that causes the error; are there also inputs not causing an

Re: Error in the if block

2006-02-19 Thread Hans Meier (John Doe)
Ron Smith am Sonntag, 19. Februar 2006 21.27: I changed this too. Thanks, Hans! [irrelevant parts snipped away] The irrelevant was not quite true... As always, John W. Krahn looked closer into the code, finds simpler solutions and does not miss to point to the appropriate documentation - if

[OT] Re: perl with databases

2006-02-19 Thread Hans Meier (John Doe)
Owen Cook am Sonntag, 19. Februar 2006 22.21: I suggest you use Matt Sergeant's DBD::SQLite a Self Contained RDBMS in a DBI Driver. It rocks Owen, thanks a lot for this tip!!! The aggregate function feature looks very promising :-) Hans -- To unsubscribe, e-mail: [EMAIL PROTECTED] For

Re: Process large file with hash

2006-02-18 Thread Hans Meier (John Doe)
Andrej Kastrin am Samstag, 18. Februar 2006 14.08: Dear Perl users, I try to parse 20.000.000 records file but... To solve my recent Perl problem I collect my previous posts on this list. I have bar separated file (FILE_A): name1|10 name2|20 name3|5 name4|30 etc. I processed it with

Re: populating a Hash

2006-02-18 Thread Hans Meier (John Doe)
David Gilden am Samstag, 18. Februar 2006 16.29: Good morning, Good evening here ;-) I would like to populate a hash from a csv text file, then test for the existence of a value in the hash. If not found return an error message and exit. ithe text file will have the format of: # whitelist

Re: property definition

2006-02-17 Thread Hans Meier (John Doe)
Kenneth Moeng am Freitag, 17. Februar 2006 07.21: Hello there, I have a problem with property definition of this code, please have a look. #!/usr/bin/perl -w Hello, What is the property definition in your code and what problems do you have with it? Hans -- To unsubscribe, e-mail: [EMAIL

Re: [RESOLVED (workaround?)] Re: Strange Can't locate Module.pm in @INC error after chaning from 'use lib' to PERL5LIB

2006-02-15 Thread Hans Meier (John Doe)
Tom Phoenix am Mittwoch, 15. Februar 2006 01.59: On 2/14/06, Hans Meier (John Doe) [EMAIL PROTECTED] wrote: I'm fine with that, but still don't understand how a path present in @INC is ignored. It sure looks like it's in @INC, from the message. (You may know that PERL5LIB is sometimes

Strange Can't locate Module.pm in @INC error after chaning from 'use lib' to PERL5LIB

2006-02-14 Thread Hans Meier (John Doe)
Dear list It's very strange: My apache doesn't start with [error] Can't locate SMF/Config.pm in @INC (@INC contains: /opt/smf/lib [...]) at /opt/smf/apconf/backend/httpd_startup_smf.pl line 228. But why? The file is there: # ls /opt/smf/lib/SMF/Config.pm /opt/smf/lib/SMF/Config.pm and the

[RESOLVED (workaround?)] Re: Strange Can't locate Module.pm in @INC error after chaning from 'use lib' to PERL5LIB

2006-02-14 Thread Hans Meier (John Doe)
Hans Meier (John Doe) am Dienstag, 14. Februar 2006 19.08: It's very strange: My apache doesn't start with [error] Can't locate SMF/Config.pm in @INC (@INC contains: /opt/smf/lib [...]) at /opt/smf/apconf/backend/httpd_startup_smf.pl line 228. But why? The file is there: # ls /opt/smf

Re: regexpressions help

2006-02-14 Thread Hans Meier (John Doe)
Gerald Wheeler am Dienstag, 14. Februar 2006 21.03: I am trying to allow input of a person's first and last name in one form field, nothing more, nothing less There should be only one uppercase A-Z character followed by one or more lowercase a-z characters followed by one space followed by

Re: regexpressions help

2006-02-14 Thread Hans Meier (John Doe)
Hans Meier (John Doe) am Dienstag, 14. Februar 2006 21.35: if (/^\s*([A-Z][a-z])+\s*([A-Z][a-z])+\s*$/) { # input is ok, so now we format: my $formatted=$1 $2; do_something_with($formatted); } Sorry, this is completely bullshit, shuld have tested before hitting send. my $userinput

Re: Stopping a Service with cgi

2006-02-14 Thread Hans Meier (John Doe)
nishanth ev am Dienstag, 14. Februar 2006 17.56: hello Friends, Have anyone tried stopping a service say httpd usng a cgi script ? I have set a setuid for the cgi script and the script is in the root cgi-bin directory namely /var/www/cgi-bin/ with ownership root and have the following

Re: substitution

2006-02-13 Thread Hans Meier (John Doe)
Bowen, Bruce am Sonntag, 12. Februar 2006 22.31: I have a text string = ^0176 ^0176 I have set $a = ^0176 ^0176; I have set $b = ^0176 ; I'm using text =~ s/$a/$b/g; And the text string doesn't change. I expected it to come out as ^0176 after the substitution. What is wrong with my

Re: single step - debug mode

2006-02-13 Thread Hans Meier (John Doe)
Stephen Mayer am Montag, 13. Februar 2006 17.25: Bruce, What you want to use is `perl -d file.pl arguments` ...and especially the manuals provided with every perl installation, which is a very valuable source for information. Some tips: $ perldoc perl # lists manuals. # search if a

Re: BerkeleyDB

2006-02-13 Thread Hans Meier (John Doe)
Tom Allison am Dienstag, 14. Februar 2006 02.28: I was trying out some jobs with the Berkeley DB and decided to move up from DB_File to BerkeleyDB. I don't need a lot of features, just speed. But I keep running into a dumb error that doesn't make any sense to me. untie attempted while 1