Re: Counting specific elements in a XML object

2006-03-30 Thread Bob Showalter
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. Here's a slightly more complex Perl one-liner that counts *occurences* perl -lne

Re: Clearing tables...

2006-03-09 Thread Bob Showalter
Sky Blueshoes wrote: What is the sequel statement to clear an entire table using DBI? It depends on your database, but typically: $dbh-do('delete from some_table'); Some databases support TRUNCATE: $dbh-do('truncate some_table'); -- To unsubscribe, e-mail: [EMAIL PROTECTED] For

Re: multistring replacement

2006-03-08 Thread Bob Showalter
Chas Owens wrote: On 3/8/06, Eugeny Altshuler [EMAIL PROTECTED] wrote: snip local $/; # to slurp the file at once my $joined=; ... Be careful with the setting of $/. In small scripts like this one it is not very dangerous, but in larger scripts in can cause all manner of bugs if not properly

Re: the way to get current index of an array

2006-02-28 Thread Bob Showalter
[EMAIL PROTECTED] wrote: hi, perlers, Is there a simple way to get the current index of an array in loop statement? the procondition is you cannot get this information from array element. For example #!usr/bin/perl my @arr = qw/a b c d e/; for(@arr) { print The No.?? element is $_\n; }

Re: Array of arrays

2006-02-28 Thread Bob Showalter
Tommy Grav wrote: print $refstars[1][0] ; # - This is line 38 However this code returns an error I do not understand Missing right curly or square bracket at refstar.pl line 38, at end of line syntax error at refstar.pl line 38, at EOF Execution of refstar.pl aborted due to

Re: survive with exec

2006-02-27 Thread Bob Showalter
a b wrote: Here i want to execute one and then execute another but don't wait for previous command i.e.something in background but im unable to do it. see: perldoc -q 'How do I start a process in the background?' -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands,

Re: print_r in Perl

2006-02-24 Thread Bob Showalter
Johannes Ernst wrote: I realize why it does that. I'm asking whether I can have something higher-level that works for objects on the abstraction level where one usually looks at an object. Data::Dumper is designed to produce Perl source code that can be eval'd to reconstruct the object. So

Re: :: and -

2006-02-18 Thread Bob Showalter
Ken Perl wrote: what is the difference of :: and - in this statements? $authInstance = Operation::Auth::getInstance($session,$u-authMethod,$u-userId) This is a subroutine call, passing 3 arguments. $authInstance = Operation::Auth-getInstance($session,$u-authMethod,$u-userId) This is

Re: whereis the socket mailing list

2006-02-09 Thread Bob Showalter
Jeff Pang wrote: The question I want to know is,when the 'close()' call happened,if it should generate a 'FIN' and send it to another end?If it's true,then at the server end,when it receive the 'EOF' coming from client,it can delay for some time to call 'close()',so the 'FIN' should not be sent

Re: connect to oracle server

2006-02-09 Thread Bob Showalter
jm wrote: i've asked oracle's forums and gotten nothing useful, so hopefully someone here can help... i have scripts that connect to mysql; they need to connect to an oracle server. i've tried installing DBD::Oracle from cpan, and get an error message about The ORACLE_HOME environment

Re: connect to oracle server

2006-02-09 Thread Bob Showalter
jm wrote: On 2/9/06, Bob Showalter [EMAIL PROTECTED] wrote: I think you have enough software. If you can run SQL*Plus, you should be OK. Try using just /usr/lib/oracle/10.2.0.1 or /usr/lib/oracle/10.2.0.1/client as your ORACLE_HOME. Also, be sure to look at the README's with the DBD::Oracle

Re: Saving Content of HTTP::Response Directly To Disk

2006-02-05 Thread Bob Showalter
Stephen Le wrote: I'm writing a download manager in Perl and using the LWP library of Perl modules. Is there any way I can save the contents of a HTTP::Response object directly to disk? I don't want particularly large requests to be cached into memory. Yes. Look at the documentation for

Re: scope of the variable?

2006-02-03 Thread Bob Showalter
[EMAIL PROTECTED] wrote: ... My question is how to access $dbaccess variable (object) defined and initialized in test.pm within test2.pm module? If $dbaccess is delared with 'my' in test.pm, you cannot directly access it from another file. You have two basic options: 1. Provide an accessor

Re: Quoting question

2006-01-25 Thread Bob Showalter
Michael Weber wrote: Greetings! I am not completely understanding how perl parses quotes. Here is the line I want to execute: exec $command $cmd_msg; The variable $command is an executable shell script test.sh The problem comes in the $cmd_msg variable. This contains a line from my log

Re: return values evaluating to true

2006-01-25 Thread Bob Showalter
radhika wrote: Hi, I have a snippet of code as below. Even when I return 0 or '', why does @blocks evaluate to true? If rows returned are 0, then if(@blocks) should evaluate to false, correct? ... sub do_something { my @row = @_; return @row if(@row); return ''; } @blocks

Re: file test

2006-01-24 Thread Bob Showalter
hien wrote: dear all, i am trying to check if there are any files named file* (e.g. file_001.txt file1.doc) in my directory. if( -e file* ) { print(true\n); } # this doesn't work else { print(false\n); } if( -e m/^file/ ) { print(true\n); } # this doesn't work either else { print(false\n);

Re: still confused on how to locally install perl modules without administrative privileges on windows (activestate 5.6.1 build 630)

2006-01-20 Thread Bob Showalter
Wolcott, Kenneth A wrote: Hi; It would be really nice if there was a clear, precise, concise, accurate and simple instruction of how to install Perl modules locally (non-privileged accounts) on Windows systems. http://www.cpan.org/misc/cpan-faq.html#How_install_Perl_modules really

Re: Simplest Way

2006-01-19 Thread Bob Showalter
Gladstone Daniel - dglads wrote: What would be the simplest way to remove leading and trailing blanks from a user input? To remove just blanks (but preserving possible trailing newline): s/^ +//, s/ +$// for $input; To remove all whitespace: s/^\s+//, s/\s+$// for $input; I like this

Re: retrieving from opendbm

2006-01-17 Thread Bob Showalter
Anders Stegmann wrote: Hi! Why doesn't this work? Aargh! *Please* see http://perl.plover.com/Questions4.html You're expecting us to read your mind, so here goes... use strict; use warnings; my %result_hash = qw(foo bar); dbmopen(%result_hash, BB, 0666); BB needs to be

Re: Combine multiple lines into one line

2006-01-16 Thread Bob Showalter
Andrej Kastrin wrote: Hi all, I have the file, which looks like: *RECORD* *ID* 001 *TITLE* Here is title number one. *ABSTRACT* First sentence of the abstract. Second sentence of the abstract... Second line of the abstract. *RECORD* *ID* 002 *TITLE* Here is title number one. *ABSTRACT* First

Re: SOLVED Re: Obtaining complete Unix command line that evoked script as string

2006-01-12 Thread Bob Showalter
Grant Jacobs wrote: I want is the whole command *line*, not the portion of it that evoked the script, the latter being the individual *command* within the command line--confusing enough ;-) ? If I issue the example I gave in my OP: echo -n Starting... ; more some-stuff | \ doStuff.pl -

Re: why a.pl is faster than b.pl

2005-12-29 Thread Bob Showalter
Jeff Pang wrote: Hi,bob, You said: 3. It will probably be faster to use a single regex of the format: /pata|patb|patc|patd/ In fact maybe you are wrong on this. Darn. First time this year :-) Based on my test case,the RE written as below: /pata/ || /patb/ || /patc/ || /patd/ is

Re: why a.pl is faster than b.pl

2005-12-28 Thread Bob Showalter
Jeff Pang wrote: hi,lists, I have two perl scripts as following: a.pl: #!/usr/bin/perl use strict; my @logs = glob ~/logs/rcptstat/da2005_12_28/da.127.0.0.1.*; foreach my $log (@logs) { open (HD,$log) or die $!; while(HD){ if ( ($_ =~ /×¢²á/o) || ($_ =~ /Õ÷ÎÄ/o) || ($_ =~

Re: Reading the built-in number variables

2005-12-20 Thread Bob Showalter
[EMAIL PROTECTED] wrote: The issue: I have a routine which builds a regex and 'knows' which paren matches to use afterwords. For instance after a line such as: use strict; my $data =~ m/^(\S+)\s+((\S+\s+)?(\S+))$/; the routine 'knows' it wants $1 and $4. Another pass through the regex will

Re: Am a newbie ....

2005-12-20 Thread Bob Showalter
Brahadambal S wrote: Hi, Could anyone tell me how to execute a .bat or .exe file through Perl? i.e, the perl code should invoke the executable. Thanks so much for your help(in advance). Perl has two standard ways: 1) system() function, which executes an external program and returns its exit

Re: sort files by creation time

2005-12-15 Thread Bob Showalter
Randal L. Schwartz wrote: Jeff == Jeff Pang [EMAIL PROTECTED] writes: Jeff and we can use the _ handle to avoid stat'ing twice. Jeff Sorry,I don't know what is _ handle.Who help explain with it please,thanks. It's documented. I refuse to retype the docs for a thing. :) Specifically, see

Re: sort files by creation time

2005-12-13 Thread Bob Showalter
Brian Volk wrote: Of course I have one more rookie question and a reference to a perldoc is just fine. :~) If I use the following code, why do I not need to declare the $a and the $b w/ my? Correct. This is explained in perldoc perlvar: $a $b Special package variables when using

Re: sort files by creation time

2005-12-12 Thread Bob Showalter
Brian Volk wrote: Hi All~ I'm using the glob function to grab all the files in a given directory and then using crontab to check it every 5 minutes. Once I have the files I'm using the diamond operator to read every line in every file and *do something* if the line matches. Here's my

Re: Help running some scripts

2005-12-10 Thread Bob Showalter
Gomez, Juan wrote: Hi In VB is there a way to execute a perl script ? This isn't really a Perl question; you'll get a better response on a VB list. I think the function you want is called Shell(), but I'm not positive. (If your Perl script is a CGI script on a web server, then the

Re: How to promote the efficiency

2005-12-08 Thread Bob Showalter
John W. Krahn wrote: if ( $2 128 ) { $low{ $1 }++; } else { $high{ $1 }++; } $total{ $1 }++; Why track all three? You could just track (say) low and total, and derive high as (total - low) at print time. -- To unsubscribe, e-mail: [EMAIL

Re: chop/chomp/?

2005-12-08 Thread Bob Showalter
Frank Bax wrote: What's the correct way to trim trailing newlines from a text file that might be either DOS or UNIX format for newlines? The docs (and my experience) is that chomp only works properly if the text file is native to the current operating system? I'm running on *bsd system.

Re: Parameterizing a module

2005-12-08 Thread Bob Showalter
[EMAIL PROTECTED] wrote: I see. Thanks Shawn. Since we are at it, would you mind explaining a little bit about the significance of our keyword. I have never understood it properly. Most books that I referred to say that it's a lexically-scoped global variable. What does that mean? I understand

Re: how to sleep 100 miliseconds?

2005-12-06 Thread Bob Showalter
TOKO wrote: hi. I'm new at perl and am looking for solution of let script sleep for few miliseconds. I tried sleep(0.1); but it does not work :) as I thought. Easist way IMO is to use Time::HiRes: use Time::HiRes qw(sleep); sleep(0.1); than I found this solution: select undef,

Re: which is more effective between map and foreach?

2005-12-06 Thread Bob Showalter
Jennifer Garner wrote: Hi,lists, I have a small script,when it run,it generate much more lines and put them into a file. The code for printing I writed: map { print RESULT $_,:,$ips{$_},\n } sort { $ips{$b} = $ips{$a} } keys %ips; I would write it like this: print RESULT

Re: number of spaces in a given sentence using regular expression.

2005-11-22 Thread Bob Showalter
[EMAIL PROTECTED] wrote: ... please give me the answers of these questions. Chris Devers will be along shortly... :~) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response

Re: Perl + OpenSSL

2005-11-21 Thread Bob Showalter
[EMAIL PROTECTED] wrote: Can anyone shed some light on why this doesn't work? $certificate = /some/where/file.pem; $encoded = ' . sha1($_) . '; $signed = system(`openssl rsautl -certin $certificate -encrypt -in $encoded`); $signed doesn't end up as a certificate signed value, it ends up as

Re: Find Error Message

2005-11-21 Thread Bob Showalter
[EMAIL PROTECTED] wrote: I am getting an error message - Can't stat c:*.*: No such file or directory find(\BadNames,c:\\*.*); What should the find statement look like? The argument should be a directory name (or multiple directories), not a glob pattern. So use C:\\, or c:/ -- To

Re: New on Mail::Send

2005-11-17 Thread Bob Showalter
ZHAO, BING wrote: I don't care how the perl is developing and where perl is going. I am doing stuff way fancier than what you can imagine. I am current doing a project with web input and data anaylysis and email feedback. You're right, that's *way* fancier than I can imagine! I'll not

Re: Hi All

2005-11-16 Thread Bob Showalter
Shawn Corey wrote: ...searching perldoc really, really sucks. The only search available is `perldoc -q keyword` and it only searches the FAQs and then, only their questions. That's right, only the questions; the answers are skipped! Here's a 3-line shell script I use to grep through the core

Re: How to do dos2unix for entire directory

2005-11-16 Thread Bob Showalter
Santosh Reddy wrote: I want to convert all the files which are in dos format to UNIX format. perl -pi -e 's/\cM$//' * -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response

Re: follow-up questions on Mail::Send

2005-11-16 Thread Bob Showalter
ZHAO, BING wrote: But for Mail::Send, I downloaded this huge file MailTools-1.67. I dug several modules out like Send.pm, Mailer.pm etc and saved them in the current directory. Well, that's not how you install modules. Read the README inside the MailTools tarball. And read perldoc

Re: follow-up questions on Mail::Send

2005-11-16 Thread Bob Showalter
ZHAO, BING wrote: Oh, I indeed did what you'll just told me to do: 1. I first downloaded this MailTools-1.67.tar.gz 2. ungziped it 3. cd MailTools-1.67 4. Moreed Readme, followed the instructions, until the last step, make install failed, still lots of files including a lib/ were generated.

Re: refs and variables

2005-11-16 Thread Bob Showalter
The Ghost wrote: my %hash = ( foo = 'bar' ); my $name='hash'; my $key='foo'; print $name{$key}; how can I get that to print bar? You can't, given the way you've set up %hash and $name. You're trying to take a soft reference to a lexical variable, which won't work. (well, you could

Re: What is shift ?

2005-11-14 Thread Bob Showalter
Dylan Stamat wrote: No, not the routine that deals with Arrays ! I see code like the following, everywhere: my $coolvariable = shift; Why is a new scalar being assigned to shift ? New to Perl... sorry for the lame question, but couldn't find an answer anywhere. shift is a built-in function.

Re: Is it possible with RegEx

2005-11-10 Thread Bob Showalter
Gilles wrote: Hi, I try do to a simple thing : Knowing If a string like 13 exist in a string like 123 Or if 37 exist in 12356789 I tried many solutions, but never found one good so I try to do it with loops which more difficult but not impossible I'd like to know if with RegExp it's more

Re: Connecting to a database using perl

2005-11-09 Thread Bob Showalter
Manish Uskaikar wrote: Hi, I am a real newbie to databases and perl can anyone of you help me with the packages i need to install and the sequences of functions i need to make to connect to a database and fire queries. DBI is the recommended approach for accessing SQL databases. You need the

Re: Error in module?

2005-11-09 Thread Bob Showalter
Octavian Rasnita wrote: Hi, I have tried the following test program: use Finance::QuoteHist; $q = Finance::QuoteHist-new ( symbols= [qw(IBM)], start_date = '01/01/1999', end_date = 'today', ); __END__ The program prints the following error: ERROR: Date::Manip unable to determine

Re: Storing a long value in an int [correction]

2005-11-09 Thread Bob Showalter
radhika wrote: Hi, I need to set this flag = 0x001 My code is as follows: $flag = OBJ::HALT(0x001); print(setting flag $flag\n); produces: 65536 But when I say $quote-SetFlag($flag); The flag is being set to 0; Is that a method call? $quote-SetFlag($flag) I don't know what

Re: Getopt::Long

2005-11-08 Thread Bob Showalter
Chris Knipe wrote: Hi all, Just a quick question and a couple of lines of really simple code use Getopt::Long; ... GetOptions ('h' = \$h, 'b=s' = \$s ); Sub ShowHelp() { That should be sub ShowHelp { Perl isn't VB :) print this is help } Sub

Re: processing at preset times

2005-11-08 Thread Bob Showalter
Frank Bax wrote: I have script that takes a very long time to run - hours, sometimes even days (even on a P2-2.8Ghz machine. After loading some data from a database at the beginning (less than a second), the script does no i/o until results are output at the end of script. I'd like to know

Re: PS what is the correct/efficient function to create a file

2005-11-08 Thread Bob Showalter
ZHAO, BING wrote: Hi, unlink $file works fine, but link $file doesn't even exist, link() does exist, but it corresponds to link(2) syscall. perldoc -f link The sysopen function seems to be tedious, does anyone know how to effectively create a file in

Re: Regex

2005-11-07 Thread Bob Showalter
[EMAIL PROTECTED] wrote: I have a field that looks like this: 'modprobe: modprobe: Can't locate module char-major-10-134' I need to add a single quote so that it looks like this: 'modprobe: modprobe: Can''t locate module char-major-10-134' But I have no idea how to go about doing that, can I

Re: XML Help

2005-11-03 Thread Bob Showalter
Scott Taylor wrote: Hi All, I'm using XML::Simple to parse a very simple XML file and dump the data into hashes of hashes. The problem I'm getting, is sometimes information is blank in the XMl file; it looks like this: STREETNUM/ instead of STREETNUM1234/STREETNUM and when I print the hash:

Re: XML Help

2005-11-03 Thread Bob Showalter
Scott Taylor wrote: Dermot Paikkos said: I would also say that the source file is wrong, it should read STREETNUM/STREETNUM I read somewhere that blah / is correct syntax (same as blah/blah) You are correct. The two forms are exactly equivalent. see:

Re: quickly snag all numbers

2005-11-02 Thread Bob Showalter
Bryan R Harris wrote: I'd like to snag all the whitespace padded numbers in $_ into an array, e.g. in the following: 1 M_fx,-3,+2.p2 -31.4e-1 4. I'd like to pick up only the 1, -31.4e-1, and 4. I've tried: $ss = qr/(^|\s)[+-]?[0-9]+\.?[0-9]*([eE][+-]?[0-9]+\.?[0-9]*)?($|\s)/; @list =

Re: quickly snag all numbers

2005-11-02 Thread Bob Showalter
Bryan R Harris wrote: Bryan R Harris wrote: I'd like to snag all the whitespace padded numbers in $_ into an array, e.g. in the following: 1 M_fx,-3,+2.p2 -31.4e-1 4. I'd like to pick up only the 1, -31.4e-1, and 4. I've tried: $ss =

Re: How to detect if the other end of the TCP connection has gone offline

2005-10-31 Thread Bob Showalter
Karjala wrote: I'm writing a simple client-server application, and I'm trying to find a way to tell if the other end of an open TCP connection has gone offline. If the other side has closed its end of the connection, you detect this by reading from the socket and receiving EOF (0 bytes read),

RE: send email with Perl

2005-10-27 Thread Bob Showalter
Charles Li wrote: Hi, I am using use Net::SMTP; to send email to multiple people. But the recipients can not send the other receiver emails. It just says undisclosed recipients. How do I send email to multiple people and let them see who is on the To list? Include a To: header in the

RE: running interactively

2005-10-12 Thread Bob Showalter
Adriano Allora wrote: ha to all, Ha back! I need to use a a shell-program but I cannot pass all the arguments to this program via system() function. In other words: the program doesn't accept all the arguments via command line: I need to open it and write interactively some instructions.

RE: XML [AntiVir checked]

2005-10-11 Thread Bob Showalter
Naji, Khalid wrote: Hi, Which Module could you recommend for the use of the XML (XML::Simple, XML::Parser and XML::Writer, XML::DOM, XML::PATH...) ? To add to what Wiggins said, I would also take a look at the XML::LibXML family of modules, and look at SAX parsing. These are newer than some

RE: keeping track of the 'age' of a file

2005-10-11 Thread Bob Showalter
ZHAO, BING wrote: But, I figured it might be a good idea to save the file for like a week then delete it, if I know some kind of function like clock(as wild as it can get..), date etc, so after a week or so, the perl script would delete the file. The classic way to do this

RE: compare two files

2005-10-11 Thread Bob Showalter
Jeff Pan wrote: hi, Is there a best way to find some lines which exists in both two files? I usually use the Unix comm(1) utility. Its very efficient, but the input files need to be sorted. Google for ppt comm and you can find a Perl version. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For

Re: Using the module HTTP::Request

2005-09-30 Thread Bob Showalter
Ranish wrote: But the output of the code is perl aprequest.pl HTTP::Response=HASH(0x81e8a84) How can I make this human readable. print $response-as_string; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

RE: general retry function

2005-09-28 Thread Bob Showalter
Chris Devers wrote: while ( $tries 10 ) { my $result = do_something_risky(); break if ( $result != 0 ); last, not break -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response

RE: Forcing a save as' dialogue box to come up on left click

2005-09-20 Thread Bob Showalter
Tony Frasketi wrote: Hello Listers I'm trying to find a way to force a download dialogue box to come up when the user clicks on a link on a web page (the link will primarily be for htm, .txt files on the server). Short answer is that you cannot *force* the client to do anything. The HTTP

Re: cookies as hidden files

2005-09-16 Thread Bob Showalter
Denzil Kruse wrote: Well, this is what I witnessed. I'm using a windows computer at home. It is configured to display hidden files. I have a red hat linux server off who knows where that hosts my site. I set up a perl script to set and fetch cookies, and it does so correctly on my computer.

Re: Yet another package problem

2005-09-16 Thread Bob Showalter
Luinrandir wrote: ### Inn.pl # ## package Inn; Buy {} Sell {} Talk {} Sleep {} Delivery {} Work { # GameTime(.1); # SendOff(); print qq|Well afraid I do all my own work Try another business|; } ... Did

Re: Problem with package

2005-09-15 Thread Bob Showalter
Luinrandir wrote: package Inn; BEGIN {} END {} return 1; An error comes up when I include the END{} but not the BEGIN{} any clues? Er, WTF are you trying to do? What is the error? You can't use return outside of a sub. The normal idiom is a bare 1 to provide a true result for

Re: Why is my package executing everything!

2005-09-15 Thread Bob Showalter
Luinrandir wrote: My package is executing ALL subroutines when required? why? Since you don't show us your code, how on earth are we supposed to guess? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: Question about data storage

2005-09-15 Thread Bob Showalter
Peter Rabbitson wrote: * I store dirty orders as XML in a SQL table with 2 columns - one for the order id and another for the arbitrary XML structure. Problem once again is that my XML can be thousands of characters long. I vote for this option. You can use a TEXT or MEDIUMTEXT column to store

Re: Problem with package

2005-09-15 Thread Bob Showalter
Bob Showalter wrote: You can't use return outside of a sub. The normal idiom is a bare 1 to provide a true result for require(). I'm wrong. You _can_ return from a do FILE construct. So there shouldn't be an error. (suggest you remove the return anyway; it isn't normally used

RE: Perl DBI / SQL Question

2005-09-14 Thread Bob Showalter
Vance M. Allen wrote: I need to know how to retrieve through Perl DBI a listing of possible ENUM elements from a field for processing under a CGI script. Need to know what database you're talking about. This will probably involve querying data dictionary views or tables. Some DBI drivers also

RE: Why wont this work? Package require question

2005-09-14 Thread Bob Showalter
Jeff 'japhy' Pinyan wrote: Now you want to call the Inn::HTML() function, right? You can't easily do it if strict is turned on. Here's one way, though: my $glob = $main::{$Player{Location} . ::}{HTML}; $glob-(); Or just turn off strict for a sec: { no strict 'refs';

RE: @ARGV

2005-09-14 Thread Bob Showalter
Christopher Spears wrote: From what I understand, @ARGV contains invocation arguments. Then how come I cannot access the first element with $ARGV[0]? What would be the proper way to do this? Well, you can access the first element as $ARGV[0], so something else is going on. Show us your

Algorithm Help Needed

2005-09-13 Thread Bob Showalter
Guys, I need help with an algorithm. I'm writing a program that sends a repeated pattern of requests to a service. Each request has a weight that controls the relative frequency with which I need to send that particular request. So given: foo = 1 bar = 3 I would send four requests, one of

RE: Algorithm Help Needed

2005-09-13 Thread Bob Showalter
Jeff 'japhy' Pinyan wrote: The extreme cases are the easy ones, though. What I'd like to see are cases like: foo = 1 bar = 2 qux = 3 baz = 4 zip = 5 Once I know what the algorithm's outcome should be for something like that, I think I can develop it. Here's what I've

Re: sendmail, etc.

2005-09-09 Thread Bob Showalter
Matthew Sacks wrote: Greetings, I want to send mail from my perl code. (Boy, that's really unusual) I am thinking using mail::mailer. I need a bit more info than what I have so far found in the online documentation (perldoc -q mail). Where I can I find some advice? E.G., there is always

RE: CHILD_ERROR and forking within a child

2005-09-07 Thread Bob Showalter
steve abrams wrote: * code 'paraphrased' for simplicity * Hi all, I have a script which goes to a subroutine. Within the subroutine, there exists: $pid = fork; push(@pids, $pid); unless ($pid) { my $var = new Object; if (not $var-method_that_evokes_a_child())

RE: :Oracle installation script assumes oracle is installed local ly?

2005-08-31 Thread Bob Showalter
[EMAIL PROTECTED] wrote: Hi all. I am attempting to install DBD::Oracle from the perl CPAN shell. The installation script seems to assume that oracle is installed locally. It asks me to set ORACLE_HOME to the path the oracle is installed and to try again. Well I don't have oracle installed

RE: can any body tell me how to remove quotes from a name.

2005-08-31 Thread Bob Showalter
[EMAIL PROTECTED] wrote: Could any body tell me how to get mayank from 'mayank' $var =~ tr/'//d; sp. by map or grep command Those functions are not appropriate to the problem as you've described it -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL

RE: Force a file download for link

2005-08-30 Thread Bob Showalter
Denzil Kruse wrote: Hi, I want my users to download a csv file. When they left click on the link, it brings the file up within the browswer. They can of course do a right click and Save Target As depending on the browser. But I don't want to fuss with instructions and confused users.

RE: system (cd ..)

2005-08-29 Thread Bob Showalter
Eliyah Kilada wrote: Hi, It seems that the following code gives unexpected results: system (cd $dir_name); system (pwd); --- this prints the old directory name not the new one. In other words, the previous (cd) command hasn't taken its effect! Do anyone know why? Each call to system()

RE: How check DBI version on the server?

2005-08-29 Thread Bob Showalter
Maxipoint Rep Office wrote: How check DBI version on the server? perl -MDBI -le 'print $DBI::VERSION' -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response

RE: open and edit file to prevent race conditions

2005-08-29 Thread Bob Showalter
Brent Clark wrote: Hi List I have a scenario / debate if you wish with my colleague. The problem is I have to update a CSV file and the way I do it open the file while reading / editting it I then send it to a temp file, unlink the original and the rename the temp to the original file

RE: encrypt the password stored in a file

2005-08-29 Thread Bob Showalter
Ken Perl wrote: The password used to access a ftp server is stored in a text file, the perl program gets the password from the file, the pass it to the ftp server for logon, this is the background. The requirement is encrypt the password store in a more secure way, and the perl program could

Re: Need a list of files in a dir.

2005-08-26 Thread Bob Showalter
Daniel Kurtz wrote: Ooh ooh ooh! One I know! open(COMMAND, dir |); @files = COMMAND; Please tell me you're kidding. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response

Re: Need a list of files in a dir.

2005-08-26 Thread Bob Showalter
Daniel Kurtz wrote: Bob Showalter wrote: Please tell me you're kidding. Why? It works. The question asked how you can do it, not the BEST way to do it. And after a week of Perling, this was the one way I knew. Now I know two ways. g OK, you weren't kidding. Since you're new to Perl, you

RE: use Module VERSION; ignoring version???

2005-08-25 Thread Bob Showalter
JupiterHost.Net wrote: How come use MODULE VERSION; works sometimes and not others? In this case: $ perl -mstrict -we 'use CGI 3.12;print $CGI::VERSION\n;' CGI version 3.12 required--this is only version 3.11 at -e line 1. BEGIN failed--compilation aborted at -e line 1. $ perl -mstrict

RE: IO::Socket squirreliness

2005-08-24 Thread Bob Showalter
Mason Loring Bliss wrote: On Tue, Aug 23, 2005 at 11:10:58AM -0400, Mason Loring Bliss wrote: Hi, all! I'm learning about dealing with sockets in Perl, and I've got a question about some unexpected behaviour exhibited by the following test script. In the case where I open a connection

RE: IO::Socket squirreliness

2005-08-24 Thread Bob Showalter
Bob Showalter wrote: I don't think there's any problem with IO::Socket. Even if accept returns a socket, you should receive an EOF on that socket when you try to read from it, which tells you that the peer has closed the connection. I think you just need to check for both situations: an error

RE: Seeding variables from command line

2005-08-09 Thread Bob Showalter
[EMAIL PROTECTED] wrote: Sorry to bother everyone, but i was working on this yesterday and i couldn't get it to work. I guess i have the wrong syntax for passing variables in from the command line. Here's my script: = crypt.pl = #!/usr/bin/perl my $pwd = $1; my $seed = $2; my

RE: Is there any Makefile.pl example?

2005-08-09 Thread Bob Showalter
Yu Wang wrote: Hi, I have written a program using Gtk2 in Perl. It's the first time I write program in Perl, so I need some help in writting the Makefile.pl I have 1 file for main program, and 5 files for modules. Besides that, I also have document files and some data files to be accessed

RE: IF statements and modules - do they mix?

2005-07-27 Thread Bob Showalter
Charles K. Clarkson wrote: Dave Adams mailto:[EMAIL PROTECTED] wrote: Does perl allow you to conditionally include a module? In general, you can load a module at runtime by using 'require' and manually running its import() sub routine. require Module; Module::import( 'Import list'

Re: How to use % in MySQL SQL statement from Perl?

2005-07-24 Thread Bob Showalter
Siegfried Heintze wrote: The following code works with perl/MySQL. If I comment the second line, however, it does not work. No error messages and no results. If I use the MySQL Enterprise console and type in my first SELECT statement that includes the LIKE clause, it works. I'm stumped. There

RE: setting a user passwd

2005-07-22 Thread Bob Showalter
Victor Pezo wrote: Hi, I am developing a program that sets passwd for any user but i dont want the operator sets the passwd. I want to give it as a result of a function [EMAIL PROTECTED] victor]$ perl passwd.pl victor1 #!/usr/bin/perl $usuario=$ARGV[0];

RE: to () or not to (), that is the question.

2005-07-21 Thread Bob Showalter
Brent Clark wrote: Hi list Would someone be so kind as to share some light on this for me. I have the following code: ($fileName) = ($_ =~ /regexcode/o); Which gives me the correct data. But if I make it like so (note the () missing around the variable): $fileName = ($_ =~

RE: Hash reference structure

2005-07-21 Thread Bob Showalter
Jan Eden wrote: Hi, I need to store a list of month names into a hash structure such that: $self-{monate}-{1}-{bezeichnung} = 'Januar' $self-{monate}-{2}-{bezeichnung} = 'Februar' etc. Until now, I have used the rather clumsy: @month_hash{1..12} = (Januar, Februar, März, April, Mai,

RE: Hash reference structure

2005-07-21 Thread Bob Showalter
Bob Showalter wrote: $self-{monate}{$_}{bezeichnung} = $month_hash{$_} for 1..12; That could also be 'for keys %month_hash' -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response

RE: cool tricks for inserting element into array?

2005-07-20 Thread Bob Showalter
Bryan R Harris wrote: I'd like to turn array @tmp from: (1,2,3) to (1,|,2,|,3) I'm using: @tmp = split(' ', join( | , @tmp)); ... but it seems like a waste to create a string and then split it back up again. I'll bet that's pretty efficient. The problem would come if

RE: Easy question

2005-07-19 Thread Bob Showalter
Neville Hodder wrote: The following code creates two Input types - a file select and a text input. The text input data is returned as expected whilst the file select data is ignored. I have not found any references for a CGI file select form tag in my documentation so I guess it is not a

  1   2   3   4   5   6   7   8   9   10   >