Re: exact string match?

2003-09-02 Thread Sudarshan Raghavan
James Edward Gray II wrote: On Tuesday, September 2, 2003, at 01:52 PM, Dan Muey wrote: if($mystr =~ m/^exactstr$/) { print 'Ye haw it matches!'; } This isn't a pattern, this is an equality test. I would consider the above a poor use of Regular Expressions. $mystr =~ /^exactstr$/ is identi

Re: Manipulating arrays

2003-09-02 Thread Visu
You can get all the basic stuff on arrays in this url http://perldoc.com/perl5.8.0/pod/perlintro.html You can get more info from this url also www.cs.cf.ac.uk/Dave/PERL/ FYI perldoc.com contains all the information related to perl in web page format. SV On Mon, 1 Sep 2003, Antonio Jose wrote:

Net::SSH::Perl

2003-09-02 Thread jaws
Hi all, I am currently using Net::SSH::Perl module to login in my remote machine. Below is my code: == #!/usr/bin/perl use Net::SSH::Perl; $user="jaws"; $pass="password"; $host="111.222.333.444"; my $ssh = Net::SSH::Perl->new($host,"'1,2'"); $ssh->login($user, $

Re: nested parenthesis in regex and launching a new process

2003-09-02 Thread Bryan Harris
Thanks for the info, James. Sounds like threading is still a ways over my head, but forking sounds interesting. I have a perl script that does simple find-replaces within all the files passed to it (the key parts were written by very kind people on this list, actually). Would it be advantageou

RE: :Mechanize and Cookies

2003-09-02 Thread Hanson, Rob
I run into this a lot. There is JavaScript in the page, and you need to emulate that in your script. Look at the source HTML for the page. It takes the password and look like it Base 64 encodes the password, then sets a hidden form field named "encoded_pw" to the value. It then clears the passw

WWW::Mechanize and Cookies

2003-09-02 Thread Pablo Fischer
Hi! Im creating an script that checks for broken links. Im using this modules: use WWW::Mechanize; use HTTP::Cookies; What Im trying to do?, I need to login in a website (cause to check broken links I need to be loged). I also checked the cookies once I've loged and they're created, however,

Re: ref array trouble - kinda difficult i recon

2003-09-02 Thread John W. Krahn
Dan Muey wrote: > > if($c =~ m/0$|2$|4$|6$|8$/){ $c = $c - 3; } A verbose way of saying: if($c =~ /[02468]$/){ $c -= 3 } Or: if(!($c % 2)){ $c -= 3 } :-) John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands

Re: taint mode for cgi script

2003-09-02 Thread Vic
Bob Showalter wrote: Jenda Krynicky wrote: From: "Bob Showalter" <[EMAIL PROTECTED]> Vic wrote: I wanna ask when running Apache 2.046 under Windows XP with mod_cgi, how can I turn on the taint mode for the Perl interpretor? (i guess the shebang line wont work since windows nvr look at them anywa

Manipulating arrays

2003-09-02 Thread Antonio Jose
Hello Where can I see (web pages) examples of manipulating arrays, calculos with elements of arrays or something like that?, I am writing a program where I need to read, process, print to file, save arrays (vectors and matriz) but I am beginner using Perl and it's difficult for me to do it. T

RE: ref array trouble - kinda difficult i recon

2003-09-02 Thread Dan Muey
> This is my first ever Perl script (!) > Good for you! > The script is supposed to continously query google for hits > on the "search google for this string" and store the returnde > URLs to database. In the scipt below it should query 5 times > (0-50 hits, 10 hits returned per query) howe

Re: How to handle a comma separated file with imbedded commas

2003-09-02 Thread James Edward Gray II
On Tuesday, September 2, 2003, at 02:19 PM, JOHN FISHER wrote: I have been using the split command happily for awhile, spliting up based on commas and tildes. However, I had a problem with a new file and noticed my script had created extra fields. If you have a file like this: "Washington, Geo

How to handle a comma separated file with imbedded commas

2003-09-02 Thread JOHN FISHER
I have been using the split command happily for awhile, spliting up based on commas and tildes. However, I had a problem with a new file and noticed my script had created extra fields. If you have a file like this: "Washington, George",909,"Abraham Lincoln",-100.00, "$10,500" How can I appropri

Re: exact string match?

2003-09-02 Thread James Edward Gray II
On Tuesday, September 2, 2003, at 01:52 PM, Dan Muey wrote: if($mystr =~ m/^exactstr$/) { print 'Ye haw it matches!'; } This isn't a pattern, this is an equality test. I would consider the above a poor use of Regular Expressions. $mystr =~ /^exactstr$/ is identical to $mystr eq 'exactstr' exc

RE: exact string match?

2003-09-02 Thread Dan Muey
> How to test for exact string match? > > this doesn't work: > > $mystr == "exactstr" You've already got the numeric use of == explained and eq but no body showed you the regex that Lets you anchor it and do case sensitivity etc... if($mystr =~ m/^exactstr$/) { print 'Ye haw it matches!';

ref array trouble - kinda difficult i recon

2003-09-02 Thread Soren O'Neill
This is my first ever Perl script (!) The script is supposed to continously query google for hits on the "search google for this string" and store the returnde URLs to database. In the scipt below it should query 5 times (0-50 hits, 10 hits returned per query) however if i set the loop to run till

Re: Update Re: exact string match?

2003-09-02 Thread Tim Yohn
On Tue, 2003-09-02 at 14:21, rkl wrote: > Thanks! You guys.gals are fast! > > Ok. Use eq instead of == for string compare but does single quote or qouble > quote matter? > > thanks again, > -rkl rkl, Single/Double quotes determine interpolation of variables contained within the quotes... f

Re: Update Re: exact string match?

2003-09-02 Thread James Edward Gray II
On Tuesday, September 2, 2003, at 01:21 PM, rkl wrote: Thanks! You guys.gals are fast! ;) Ok. Use eq instead of == for string compare but does single quote or qouble quote matter? Double quote interpolate variables and special characters inside on them, so: "\t$mystr" becomes " exactstr" minu

Update Re: exact string match?

2003-09-02 Thread rkl
Thanks! You guys.gals are fast! Ok. Use eq instead of == for string compare but does single quote or qouble quote matter? thanks again, -rkl rkl writes: How to test for exact string match? this doesn't work: $mystr == "exactstr" thanks -rkl -- To unsubscribe, e-mail: [EMAIL PROT

RE: exact string match?

2003-09-02 Thread Hanson, Rob
Use "eq" (as well as lt, gt, ne, ge, le, cmp) for string matching. The operators "==" (as well as <, >, !=, >=, <=, <=>) for numeric matching. Perl will convert the values based on the operator used. So with "==", like you are using, Perl converts both arguments to numbers before comparing. So t

Re: exact string match?

2003-09-02 Thread James Edward Gray II
On Tuesday, September 2, 2003, at 01:12 PM, rkl wrote: How to test for exact string match? this doesn't work: $mystr == "exactstr" You're very close. == is for testing numbers, just change it to eq which is for testing strings: $mystr eq 'exactstr' Hope that helps. James -- To unsubscribe,

RE: exact string match?

2003-09-02 Thread Wagner, David --- Senior Programmer Analyst --- WGO
rkl wrote: > How to test for exact string match? > > this doesn't work: > > $mystr == "exactstr" The double equal sign is numeric compare. If you want to use equal then eq should replace the == Wags ;) > > thanks > -rkl ** Th

exact string match?

2003-09-02 Thread rkl
How to test for exact string match? this doesn't work: $mystr == "exactstr" thanks -rkl -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: base domain parsing www.mydomain.com

2003-09-02 Thread Tim Yohn
On Tue, 2003-09-02 at 12:54, perl wrote: > Please help me parse this www.mydomain.com to just mydomain.com > > Below are some scenarios in which all I want is the last two values, > mydomain.com : > > mydomain.com = mydomain.com > www.yourdomain.com = yourdomain.com > www.station.fire.org = fi

RE: base domain parsing www.mydomain.com

2003-09-02 Thread Hanson, Rob
Something like this should work... my $domain = 'www.station.fire.org'; if ($domain =~ /([^\.]+\.[^\.]+)$/) { print "$1\n"; } else { print "Failed to find domain\n"; } This is very lenient in the matching, so it should match all valid domain names as well as a lot of invalid ones. If th

RE: Hide password in MS DOS

2003-09-02 Thread Ned Cunningham
I am sure there are way better ways, in my case I am using the base load of Perl. I have over a 1000 computers with this same load that I need to be able to update and Win32::Console is loaded already. I wish I had TK loaded but I don't, so I use what I have :-) I just happened to be walking thro

base domain parsing www.mydomain.com

2003-09-02 Thread perl
Please help me parse this www.mydomain.com to just mydomain.com Below are some scenarios in which all I want is the last two values, mydomain.com : mydomain.com = mydomain.com www.yourdomain.com = yourdomain.com www.station.fire.org = fire.org results in just the base domain. thanks -- T

RE: Hide password in MS DOS

2003-09-02 Thread Ned Cunningham
Funny you just caught me working on something similar, and I have modified this code for my purposes. This should lead you in the right direction! Snip #!/usr/bin/perl use Win32::Console; $StdIn = new Win32::Console(STD_INPUT_HANDLE); my $Password = ""; $StdIn->Mode(ENABLE_PROCESSED_

Re: new, exciting error message III

2003-09-02 Thread david
John Nestor wrote: > A couple of days ago, I sent in some code with an error message: > > Can't find unicode character property definition via main->a or a.plFile > 'unicode/Is/a.pl'; Line 0 > > As it turns out, the code sample I included was not the cause of the > problem, apparently. However,

Access

2003-09-02 Thread Olivier6
Hello, >From an Oracle utlfile data under unix, I generate an Excel-Worksheet with the module Spreadsheet::WriteExcel. How can I do the same, but for Access ? Thank you. Olivier -- COMPUTERBILD 15/03: Premium-e-mail-Dienste im Test -- 1. GMX Top

RE: problems with installing CPAN modules

2003-09-02 Thread Hanson, Rob
If you are on Windows with AS-Perl, you should use there version of ReadKey. I might be wrong, but I think that module includes some C code. So unless you have C++ and compiled Perl yourself, you want to use the AS version of the module, which will be pre-compiled for you. The AS module list for

Re: After "Beginning Perl"?

2003-09-02 Thread Randal L. Schwartz
> "Trent" == Trent Rigsbee <[EMAIL PROTECTED]> writes: Trent> Hi! I've completed "Beginning Perl" by Simon Cozens. What do you Trent> recommend as my next book? I'd like to tackle "Networking Programming Trent> with Perl" by Lincoln Stein or "Win32 Perl Scripting" by Roth but I'm Trent> not s

Re: nested parenthesis in regex and launching a new process

2003-09-02 Thread James Edward Gray II
On Friday, August 29, 2003, at 01:32 AM, Bryan Harris wrote: Neat! Is this how "threads" are spawned? or are forked processes different from threads? If this is how threads are spawned, how do big commercial apps manage to do multiple things at once without completely duplicating the entire

Re: After "Beginning Perl"?

2003-09-02 Thread James Edward Gray II
On Sunday, August 31, 2003, at 10:00 PM, Trent Rigsbee wrote: Hi! I've completed "Beginning Perl" by Simon Cozens. What do you recommend as my next book? I'd like to tackle "Networking Programming with Perl" by Lincoln Stein or "Win32 Perl Scripting" by Roth but I'm not sure if I'm ready for

RE: Reverse Order?

2003-09-02 Thread Dan Muey
> try > > open (INFILE, " filename.txt.$!,stopped"; @array = ; close(INFILE); > foreach my $rec (reverse(@array)) { > chomp($rec); > ($a,$b) = split(/\|/,$rec); Just a litle tip, I think it's not a good idea to use $a and $b variables since Perl uses those for sort() and whatever.

RE: Killing a windows process using Perl

2003-09-02 Thread NYIMI Jose (BMB)
Try: Win32::Process I never used so far myself but can help for what you want. http://search.cpan.org/author/GSAR/libwin32-0.191/Process/Process.pm -Original Message- From: Anthony J Segelhorst [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 02, 2003 1:50 PM To: [EMAIL PROTECTED] Subje

problems with installing CPAN modules

2003-09-02 Thread sc00170
I am on win2k, active perl 5.6.1 system. I downloaded the ReadKey module, (all the packet of Term-Readkey-2-21) I gave perl MakeFile.pl and i recieved writing MakeFile then i set make, and it says that there is not target file -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional com

Killing a windows process using Perl

2003-09-02 Thread Anthony J Segelhorst
I have been working on a Perl script that will kill a Windows Process if it has been running for an x amount of time. This script will run on a Windows Platform. pslist is a tool that can be retrieved from http://www.sysinternals.com/ntw2k/freeware/pstools.shtml the output from pslist EXCEL l

Re: Bidirectional pipes

2003-09-02 Thread Mehmet . Ekici
Hi, I have already using DBI module, I just wanted to explain with an example. Let think that I want to be root user and issue some command in that case I also need bidirectional pipes. su - root Password execute some commands here . Mehmet

Re: nested parenthesis in regex and launching a new process

2003-09-02 Thread Bryan Harris
ZSDC, I love this stuff! You explain these concepts very clearly, have you ever considered teaching? I'm happy to keep asking questions as long as you're willing to answer them. =) > Servers often work this way. There's a process listening on a port but > when someone connects, it doesn't se

Re: Bidirectional pipes

2003-09-02 Thread Sudarshan Raghavan
[EMAIL PROTECTED] wrote: Hello, I tried it to use with sqplus username/passwd after this I like to send some sql commands and get their results but at some point system blocks and I don't get anything $ph = open2 (\*Reader , \*Writer, "sqlplus xxx/yyy"); print Writer , "desc user_tables;\n"; wh

Re: Bidirectional pipes

2003-09-02 Thread Mehmet . Ekici
Hello, I tried it to use with sqplus username/passwd after this I like to send some sql commands and get their results but at some point system blocks and I don't get anything $ph = open2 (\*Reader , \*Writer, "sqlplus xxx/yyy"); print Writer , "desc user_tables;\n"; while () { print ; }

RE: looking at a string

2003-09-02 Thread NYIMI Jose (BMB)
$in=12345678.90; $out=&big_money($in); sub big_money { $number = sprintf " %.2f", shift @_; 1 while $number =~ s/^(-?\d+) (\d\d\d) /$1, $2/; $number=~ s/^(-?)/$1\$/; $number; } -Original Message- From: Ronen Kfir [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 02, 2003

looking at a string

2003-09-02 Thread Ronen Kfir
Hi, This code is taken from "learning Perl\ Schwartz & Phoenix. sub big_money { $number = sprintf " %.2f", shift @_; 1 while $number =~ s/^(-?\d+) (\d\d\d) /$1, $2/; $number=~ s/^(-?)/$1\$; $number; } In the book they write the no. 12345678.90 as the no. of example. What I

Re: Apache Log files and MySql

2003-09-02 Thread Mame Mbodji
Thanks for the link. It will be useful. But I still have a question. What do I do with it since there is no explanation and I am totally new to this. Please provide a little more detail. Thanks [EMAIL PROTECTED] wrote: see Apache::LogDBI and a discussion of it at: http://perl.apache.org/docs/t

Re: document creation.

2003-09-02 Thread Gabor Urban
Hi, thogh might seem to be a bit outmoded at the time I suggest to use TeX. It is a highly portable and rather easy-to-use system, and can beat Docbook/XML in many cases. Desing your invoice or whatever macro file, and generate the TeX input file via perl. IMHO the old technologies may give you

Re: Bidirectional pipes

2003-09-02 Thread Sudarshan Raghavan
[EMAIL PROTECTED] wrote: Hi all, I wonder how can I open pipe to STDIN and STDOUT of a process ? perldoc IPC::Open2 If you need a handle to STDERR perldoc IPC::Open3 Tnx. Mehmet -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Bidirectional pipes

2003-09-02 Thread Mehmet . Ekici
Hi all, I wonder how can I open pipe to STDIN and STDOUT of a process ? Tnx. Mehmet -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: Reverse Order?

2003-09-02 Thread Toby Stuart
> -Original Message- > From: Mark Weisman [mailto:[EMAIL PROTECTED] > Sent: Tuesday, September 02, 2003 4:53 PM > To: [EMAIL PROTECTED] > Subject: Reverse Order? > > > I read a text file into HTML for viewing through a webpage, fairly > straight forward. > > Open (INFILE, " filename.tx

RE: Reverse Order?

2003-09-02 Thread Marcos . Rebelo
try open (INFILE, "; close(INFILE); foreach my $rec (reverse(@array)) { chomp($rec); ($a,$b) = split(/\|/,$rec); print "$a - $b\n"; }; -Original Message- From: Mark Weisman [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 02, 2003 8:53 AM To: [EMAIL PROTECTED] S