Re: Is this correct in perl?

2006-04-11 Thread Dr.Ruud
Chad Perrin schreef: > Jay Savage: >> The dreaded reply-to strikes again... > > Did I miss something somewhere that explains why this list uses a > list-reply instead of reply-to? Or use news://nntp.perl.org/perl.beginners (yes, it supports posting too) -- Affijn, Ruud "Gewoon is een tijger

hex conversion to dec - print and printf differences

2006-04-11 Thread Offer Kaye
Hi, This is probably trivial, but I couldn't find a mention of this anywhere - why do the following 2 code lines produce different results? > perl -e 'printf "%d\n" ,0x_' -1 > perl -e 'print 0x_ , "\n"' 4294967295 Even stranger: > perl -e 'printf "%d\n" ,0x8000_' -2147483648 >

RE: Scraping Data Behind a Form

2006-04-11 Thread Dhanashri Bhate
Hi, The page shows 3 forms, ( 2 for Search and one for language selection ). You will first need to decide which form you want to use, and then issue submit_form function with the fields you mentioned. Something like below (untested! :) ) $browser->submit_form ( form_number => 1,

Re: Learning Perl

2006-04-11 Thread anand kumar
HI Try this #!/bin/perl use strict; use diagnostics; print "\t Enter Month of a year \n"; my $month = (); chomp($month); my %days_month = ( January => 31, February => 28, March => 31 ); print "\t Number of Days in month of $month is $days_month{$month} \n "; Regards Anand j

Qmail and PERL

2006-04-11 Thread Henry Chen
How do I use Qmail in a perl script that will allow me to redirect mail to addresses? I can't seem to find anything on google about this topic. Any suggestions would definitely help. Thank You _ Don’t just search. Find. Check ou

Re: And a CGI question.

2006-04-11 Thread M. Kristall
Closing STDOUT should be good enough for the server. Alternatively, if you know how big the content you are sending is, you can send a Content-Length header, and assuming the client doesn't ignore that (it shouldn't), the client will say the page is done when it is. It might make more sense to

RE: Learning Perl

2006-04-11 Thread Dhanashri Bhate
Hi, >>>my $month = (); When you are taking the input from STDIN, the value of $month has \n in the end, Use chomp $month; before using the value, Dhanashri -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: Qmail and PERL

2006-04-11 Thread Dhanashri Bhate
Hello, Search on CPAN shows these.. see what modules are relevant to you! http://search.cpan.org/search?query=Qmail&mode=all Dhanashri >>>-Original Message- >>>From: Henry Chen [mailto:[EMAIL PROTECTED] >>>Sent: Tuesday, April 11, 2006 2:19 PM >>>To: beginners@perl.org >>>Subject: Qmail

Static variables in Perl?

2006-04-11 Thread Dhanashri Bhate
Hello All, Is there anything as 'static variables' in Perl? I have a "utilities.pl" file which has functions commonly used in other perl programs. One of these function needs to create a temporary file in the current directory, process it and then delete it. Since this function can be called b

Re: hex conversion to dec - print and printf differences

2006-04-11 Thread John W. Krahn
Offer Kaye wrote: > Hi, Hello, > This is probably trivial, but I couldn't find a mention of this > anywhere - why do the following 2 code lines produce different > results? >>perl -e 'printf "%d\n" ,0x_' > -1 >>perl -e 'print 0x_ , "\n"' > 4294967295 perldoc perlnumber John --

Re: Static variables in Perl?

2006-04-11 Thread Jeff Pang
>I can do something like suffixing the filename with timestamp etc, >but would like to know if there can be a static variable defined in this >function which will be incremented each time a new file is created. > Hello.Using 'File::Temp' for your purpose pls,see: http://search.cpan.org/~tjenness

Re: Static variables in Perl?

2006-04-11 Thread John W. Krahn
Dhanashri Bhate wrote: > Hello All, Hello, > Is there anything as 'static variables' in Perl? > > I have a "utilities.pl" file which has functions commonly used in other perl > programs. > > One of these function needs to create a temporary file in the current > directory, process it and then

Re: hex conversion to dec - print and printf differences

2006-04-11 Thread John W. Krahn
Offer Kaye wrote: > On 4/11/06, John W. Krahn wrote: >>>This is probably trivial, but I couldn't find a mention of this >>>anywhere - why do the following 2 code lines produce different >>>results? perl -e 'printf "%d\n" ,0x_' >>>-1 perl -e 'print 0x_ , "\n"' >>>4294967295 >

Re: Learning Perl

2006-04-11 Thread nishanth ev
#!/usr/bin/perl use strict; use diagnostics; my $month; print "\t Enter Month of a year \n"; chomp($month = <>); my %days_month = ( January => 31, February => 28, March => 31 ); print "\t Number of Days in month of $month is $days_month{$month} \n"; ___

Re: hex conversion to dec - print and printf differences

2006-04-11 Thread Offer Kaye
On 4/11/06, John W. Krahn wrote: > > This is probably trivial, but I couldn't find a mention of this > > anywhere - why do the following 2 code lines produce different > > results? > >>perl -e 'printf "%d\n" ,0x_' > > -1 > >>perl -e 'print 0x_ , "\n"' > > 4294967295 > > perldoc perl

a package get mysql connection drop

2006-04-11 Thread Jeff Pang
Hello,list, I've wrote a simple package which do some socket query.The package is working well at most time,but when I use it with mysql DBH in my main script,it'll get the mysql connection drop. Here is my fullhead.pm: package fullhead; use strict; use warnings; use IO::Socket qw(:DEFAU

RE: Static variables in Perl?

2006-04-11 Thread Thomas Bätzler
Hi, Dhanashri Bhate <[EMAIL PROTECTED]> asked: [...] > I can do something like suffixing the filename with timestamp > etc, but would like to know if there can be a static variable > defined in this function which will be incremented each time > a new file is created. You can model such behav

RE: Static variables in Perl?

2006-04-11 Thread Dhanashri Bhate
Thanks! This is what I was looking for! >>>-Original Message- >>>From: Thomas Bätzler [mailto:[EMAIL PROTECTED] >>>Sent: Tuesday, April 11, 2006 3:09 PM >>>To: beginners@perl.org >>>Cc: [EMAIL PROTECTED] >>>Subject: RE: Static variables in Perl? >>> >>>Hi, >>> >>>Dhanashri Bhate <[EMAIL

Re: Static variables in Perl?

2006-04-11 Thread Dr.Ruud
"Dhanashri Bhate" schreef: > Since this function can be called by multiple programs at the same > time, its necessary that the name of the temporary file generated > each time is different. How about files that remain after the process is stopped, can they safely be reused? See also perldoc perlv

FW: RE: Qmail and PERL

2006-04-11 Thread Henry Chen
My hosting server runs Mail::Mailer::qmail. I'm ok with perl but new to the whole unix interface. Just wondering how I can get qmail setup and to get qmail to run incoming emails through a script and forward them to different addresses. And thank you very much on the reply! From: "Dhanash

How can I uninstall perl modules

2006-04-11 Thread Logg, Connie A.
I have used perl -MCPAN to install Bundle::DBD::mysql, and it appears that it is not working. I would like to uninstall the module and reinstall it. How can I uninstall a module? Connie Connie Logg, Network Analyst Stanford Linear Accelerator Center ph: 650-926-2879 "Happiness is found alon

question on Terminal I/O

2006-04-11 Thread Gavin Bowlby
I have a Perl program with a simple command line interface where the user can enter commands. I read these commands in a loop that looks like: while($rc == 0) { print "$LCLdebuggerPrompt"; $debugCommand = ; chop $debugCommand; # remove t

Re: Class::Struct: Can't access struct field elements

2006-04-11 Thread Ed
Though I'm making progress (thanks guys) I'm still having a problem with dereferencing the struct elements. I've re-read the section on References in Programming Perl and I thought what I was doing was correct, but I can't print out the values correctly. Here's a simplified version of what I'm try

Re: question on Terminal I/O

2006-04-11 Thread Mr. Shawn H. Corey
On Tue, 2006-11-04 at 11:01 -0700, Gavin Bowlby wrote: > Short of learning Perl-curses or writing a full-blown TK-Perl app, are > there any simple techniques - (read: minimum learning time) that I can > use to implement a "protect command prompt" or "retrieve up-arrow key > indication" function? N

Re: Class::Struct: Can't access struct field elements

2006-04-11 Thread D. Bolliger
Ed am Dienstag, 11. April 2006 21.50: > Though I'm making progress (thanks guys) I'm still having a problem > with dereferencing the struct elements. I've re-read the section on > References in Programming Perl and I thought what I was doing was > correct, but I can't print out the values correctl

Re: Scraping Data Behind a Form

2006-04-11 Thread kc68
I am slowly making my way through the process of scraping the data behind a form and can now get five results plus a series of links using the script below. I need help in doing the following: 1) Eliminating all material on the page other than the list and the links (and ultimately elimina

Perl regular exp

2006-04-11 Thread Sonika Sachdeva
Hi , print $line if ($line =~ /pattern1 && pattern2 && pattern3/); works .. but my $regex="$pattern1 && $pattern2 && $pattern3"; print $line if ($line =~ /$regex/); doesn't work... Any clues ? Thanks,

Re: Perl regular exp

2006-04-11 Thread Oliver Block
Am Mittwoch, 12. April 2006 00:38 schrieb Sonika Sachdeva: > my $regex="$pattern1 && $pattern2 && $pattern3"; > print $line if ($line =~ /$regex/); > > doesn't work... Why should it work? regards, Oliver -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PRO

Re: Perl regular exp

2006-04-11 Thread Sonika Sachdeva
How do I use variable string value as a regular expression? On 4/11/06, Oliver Block <[EMAIL PROTECTED]> wrote: > > Am Mittwoch, 12. April 2006 00:38 schrieb Sonika Sachdeva: > > my $regex="$pattern1 && $pattern2 && $pattern3"; > > print $line if ($line =~ /$regex/); > > > > doesn't work... > Why

Re: Perl regular exp

2006-04-11 Thread Peter Cornelius
What do you mean by 'works'? It looks to me like this will print the line if the string 'pattern1 && pattern2 && pattern3' is in the line. Not if pattern1 is in the line and pattern2 is in the line and pattern3 is in the line. Is that what you mean? I think some more detail would help me

RE: Perl regular exp

2006-04-11 Thread Ankur Gupta
Sonika Sachdeva scribbled on Tuesday, April 11, 2006 3:39 PM: > Hi , Please state your problem statement. What are you trying to achieve with this program. add use strict; use warnings; at the top of your perl program and then try to run. > print $line if ($line

Re: Perl regular exp

2006-04-11 Thread Oliver Block
Am Mittwoch, 12. April 2006 01:02 schrieb Sonika Sachdeva: > How do I use variable string value as a regular expression? print $line if $line =~ /$pattern/; regards, oliver -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Perl regular exp

2006-04-11 Thread Peter Cornelius
This matches: my $test_string = 'This is my test string'; my $pattern1 = 'This is'; print "Passed test 1 $/" if ($test_string =~ /$pattern1/); I think that at least part of your problem is the '&&' characters. I'm guessing that you don't mean to match a literal '&&' but that is what your

Re: Perl regular exp

2006-04-11 Thread Sonika Sachdeva
$str1=shift; $str2=shift; $str3=shift; my $querystring="$str1 && $str2 && $str3"; foreach (@LINES){ push @output,$_ if /$querystring/ ; } does not work even if I have @LINES containing all 3 words. Thanx, On 4/11/06, Peter Cornelius <[EMAIL PROTECTED]> wrote: > > What do you me

Re: Perl regular exp

2006-04-11 Thread Sonika Sachdeva
words to match are variable e.g array @words On 4/11/06, Sonika Sachdeva <[EMAIL PROTECTED]> wrote: > > $str1=shift; > $str2=shift; > $str3=shift; > > my $querystring="$str1 && $str2 && $str3"; > > foreach (@LINES){ > push @output,$_ if /$querystring/ ; > } > > does not work even i

Re: Perl regular exp

2006-04-11 Thread Oliver Block
Am Mittwoch, 12. April 2006 01:15 schrieb Sonika Sachdeva: > $str1=shift; > $str2=shift; > $str3=shift; > > > foreach (@LINES){ > push @output,$_ if /$querystring/ ; > } > > does not work even if I have @LINES containing all 3 words. .. pursh @output, $_ if(/$str1/ && /$str2/ && /$s

RE: Perl regular exp

2006-04-11 Thread Wagner, David --- Senior Programmer Analyst --- WGO
Sonika Sachdeva wrote: > $str1=shift; > $str2=shift; > $str3=shift; > > my $querystring="$str1 && $str2 && $str3"; > > foreach (@LINES){ > push @output,$_ if /$querystring/ ; > } > Correct because unless you have abc && efg && hij in the $_ it will not work because that

Re: Perl regular exp

2006-04-11 Thread Peter Cornelius
But I'll bet you don't have @LINES containing all 3 words separated by 2 '&' symbols. You need to break this up into: if($line =~ /$pattern1/ && $line =~ /$pattern2/) { ... } or something similar. On Apr 11, 2006, at 4:15 PM, Sonika Sachdeva wrote: my $querystring="$str1 && $str2 && $str

Re: Perl regular exp

2006-04-11 Thread Sonika Sachdeva
Actually I am looking for AND and OR combinations..and the number of words are not fixed. ie @words is the variable and I need to have OR and AND combinations of @words. to match in LINES How do I go about it? On 4/11/06, Wagner, David --- Senior Programmer Analyst --- WGO < [EMAIL PROTECTED]> wr

Re: Class::Struct: Can't access struct field elements

2006-04-11 Thread Lawrence Statton
> Though I'm making progress (thanks guys) I'm still having a problem > with dereferencing the struct elements. I've re-read the section on > References in Programming Perl and I thought what I was doing was > correct, but I can't print out the values correctly. Here's a > simplified version of wh

Re: Perl regular exp

2006-04-11 Thread Oliver Block
Am Mittwoch, 12. April 2006 01:27 schrieb Sonika Sachdeva: > Actually I am looking for AND and OR combinations..and the number of words > are not fixed. > ie @words is the variable and I need to have OR and AND combinations of > @words. to match in LINES > How do I go about it? /abc|def|ghi/ matc

RE: Perl regular exp

2006-04-11 Thread Wagner, David --- Senior Programmer Analyst --- WGO
if you want the and then what was sent is one way for that. If after 'or' then replace && with || as a start. Wags ;) -Original Message- From: Sonika Sachdeva [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 11, 2006 16:27 To: Wagner, David --- Senior Programmer Analyst --- WGO Cc: Pe

RE: Perl regular exp

2006-04-11 Thread Ankur Gupta
Sonika Sachdeva scribbled on Tuesday, April 11, 2006 4:27 PM: > Actually I am looking for AND and OR combinations..and the number of > words are not fixed. > ie @words is the variable and I need to have OR and AND combinations > of @words. to match in LINES How do I go

Re: Perl regular exp

2006-04-11 Thread Dr.Ruud
Oliver Block schreef: > Sonika Sachdeva: >> How do I use variable string value as a regular expression? > > print $line if $line =~ /$pattern/; Often you want to have special characters quoted: /\Q$pattern\E/ and print for $line; See also qr// in perlop. -- Affijn, Ruud "Gewoon is een t

Re: hash value and grep / get some files searched and indexed

2006-04-11 Thread Alan_C
Thanks to Mr. Krahn and Jaime Murilllo! Yeee Ha!!! (also, a couple more ques. about the code if I may, further below) I got the output that I want: [EMAIL PROTECTED]:~$ grepf6tst hash 1 'hash' array of hashes 2 'hash' initialize sort and print hash 3 'hash' ref deref hash array it

why is setlocale not working?

2006-04-11 Thread tom arnall
the following code: #!/usr/bin/perl -w use strict; use POSIX qw(locale_h); my ($f,@f,$g); setlocale(LC_COLLATE, "es_ES.ISO-8859-1"); @f = qw(oval óvalo zurrir); print "before sort:@f "; @f = sort @f; $f = setlocale(LC_