Re: how to capture host name to a variable

2004-11-20 Thread Bob Showalter
[EMAIL PROTECTED] wrote: Hi Frnds, I need to capture the current system name to a variable. I am doing like below but , the hostname value is not getting stored in the variable. any suggestions please ?? - $systemserver = system("hostname"); -

RE: question about doing it right in CGI

2004-11-19 Thread Bob Showalter
igure it out from there. (Hint: how many Tr's do you need? What's inside each one?) > > -Original Message- > From: Bob Showalter [mailto:[EMAIL PROTECTED] > Sent: Friday, November 19, 2004 2:57 PM > To: Lewick, Taylor; [EMAIL PROTECTED] > Subject: RE: question ab

RE: IP address and Browser version.

2004-11-19 Thread Bob Showalter
[EMAIL PROTECTED] wrote: > Hi > > I wanted to get the IP address and the OS of the system when some one > checks in the page...How will I get the IP address and OS of the > person who visits the page(with PERL CGI) Short answer: $ENV{REMOTE_ADDR} contains the client IP address $ENV{HTTP_US

RE: :SMTP change port

2004-11-19 Thread Bob Showalter
Ramprasad A Padmanabhan wrote: > I am using Net::SMTP to send mails to an SMTP server. > If the server is running on a non std port how do I send mails to this > port Not documented, but inspection of the Net::SMTP code shows that: $smtp = Net::SMTP->new($host, Port => 1234); should do the tr

RE: Date calculations and daylight saving

2004-11-19 Thread Bob Showalter
John Bruin wrote: > I have a script that calculates difference between dates and it works > well. However if the 2 dates straddle our daylight saving times > (March, October) then the result is either plus or minus an hour > compared to the expected result. Are you subtracting "dates" or "local ti

Re: MSSQL server 200 , cgi in perl

2004-11-18 Thread Bob Showalter
Chandrakant Reddy wrote: Hi Any one tried to connect Mssql server from perl which is on Solaris Machine. I installed Class::DBI::MSSQL using CPAN and also go through the perldoc Class::DBI::MSSQL but didn't get much. That's a high-level module. You need to get the lower-level plumbing in plac

RE: using printf on specified fields of record

2004-11-17 Thread Bob Showalter
Joseph Paish wrote: > following is a sample of a record generated by a perl script i have > written ( i have put each field on a separate line in this email to > prevent word-wrapping) : > > > 12/05/2003 > sold > 8000 > widget1 > 0.055 > 29.95 > 30500 > 0 > 410.05 > -173.655333717579 << change to

RE: date subtraction

2004-11-17 Thread Bob Showalter
Vladimir Lemberg wrote: > ... > Seq:1 Sat Nov 13 21:57:34 PST 2004 > Seq:2 Sat Nov 13 22:05:17 PST 2004 > Seq:3 Sun Nov 14 03:42:01 PST 2004 > Seq:4 Sun Nov 14 21:57:34 PST 2004 > > I need to subtract dates to know how long each Seg took time. Is > there any way to convert dates back to timestamps

RE: Accessing elements of an array passed by reference

2004-11-15 Thread Bob Showalter
Johnstone, Colin wrote: > Gidday all, > > I wish to access the elements of an array passed by reference Erm, OK. I don't see any passing by reference going on below... > > #get deploy list > my @$deployList = $task->GetVariable('deployList'); This is not valid Perl. If GetVariable returns an a

RE: Using 'rename' on the command line

2004-11-11 Thread Bob Showalter
Ron Smith wrote: > I'm trying to rename some files from the command line but nothing > gets changed. I think I'm leaving out something; maybe '$_'. Or, I > have incorrect syntax. I don't get any error message either. I took a > look at 'man rename', but it doesn't show an example of a loop. I'm > u

RE: using $. line number special variable (followup)

2004-11-09 Thread Bob Showalter
Joseph Paish wrote: > just a short followup to my earlier message about the $. line number > variable. when i enter a print statement as shown below, it prints > the correct line number (starting at 1), but still never enters the > if() structure. > > for the sake of understanding how to correctl

RE: Best place to put collection of subroutines in a program

2004-11-09 Thread Bob Showalter
Edward WIJAYA wrote: > Hi, > > Would like to know, where is the best place to > put collection of subroutines in a Perl program, > is it after "main" or before? Any caveat? I generally put the "main" code at the top and subs below. Perl doesn't care unless you want to call a sub without parens, i

RE: how to append test to file

2004-11-09 Thread Bob Showalter
[EMAIL PROTECTED] wrote: > Hi Frnds, > I myself found some way.Read the file to an array and created a file > as > per requirement and then inserted the objects in the array to file. > > for ($i=0;$i < $#arr;$i++) > { > print OUTPUT $arr[$i]; > } > ==

RE: rss remove item

2004-11-08 Thread Bob Showalter
Rolland, Susie (DIS) wrote: > the rss file will be created through a content management system > (Teamsite). Communication people will enter a headline and a link and > the script behind will use the wonderful XML::RSS to insert the new > item. We would like the reverse to happen also, they enter

RE: using $. line number special variable

2004-11-08 Thread Bob Showalter
Joseph Paish wrote: > how do you use the "line number" variable inside a while loop like i > am trying to do below? > > i never get to process the first line of the file, and as a result, > subsequent calculations are inaccurate. it always jumps to the > second "if" statement. The way you're usi

RE: rss remove item

2004-11-08 Thread Bob Showalter
Rolland, Susie (DIS) wrote: > We will be inserting items daily - this will be state press releases. > They will be available for one month. But often during the month > someone will want a release removed for various reasons. So are you > saying when I need to remove an item, I have to read the w

RE: how to append test to file

2004-11-08 Thread Bob Showalter
[EMAIL PROTECTED] wrote: > Hi , > > > there is an existing file and I need to append text to it ,only thing > is I need to remove the last line of existing file and then need to > append text. > I hope I am clear.If there are 6 lines in a file I have remove 6th > line > and then need to append

RE: start http request and move on

2004-11-05 Thread Bob Showalter
JupiterHost.Net wrote: > Bob Showalter wrote: ... > > Use something like the following: ... > Thanks Bob, That works great! Now the next step is to play with that > in a peristent environment without killing the persistent process > with the exit() Perhapst the system + &am

RE: start http request and move on

2004-11-05 Thread Bob Showalter
JupiterHost.Net wrote: > I don't want the user to wait > at all, just submit the form, they see the confirmation and close > their browser and the fork() finished in its own sweet time on the > server. Use something like the following: #!/usr/bin/perl use strict; use CGI ':standard'; us

RE: Illegal octal digit??

2004-11-03 Thread Bob Showalter
Konopaske Jr,Raymond E wrote: > Forgive me if this is a dumb question. I'm a newcomer to Perl. > > I was trying to do something the other day and ran across this odd > little problem. > > I had some lines in my script that looked something like this: > > $ddd = 8; > ... > if ($ddd == 08) {print

RE: How to find if the script is running on a 32-bit machine

2004-11-02 Thread Bob Showalter
Ramprasad A Padmanabhan wrote: > In a particular script , that is used on multiple unix platforms, I > need to know if my perl script is being run on a 32 bit machine or a > 64 bit machine Why? > > Is there any way I can find this portably This is just a guess, but would the Config parameter 'a

RE: XML ::SIMPLE

2004-11-02 Thread Bob Showalter
E.Horn wrote: > Hey! Back for another bite at this apple I see... > Does the XML SIMPLE Modul work if i only want to get the content of > the text between the tags? Of course. Have you tried it? > I want to parse this xmlfile so that there is just CHINA,Hallo,27832 OK. > Or do i have to use t

Re: formatting problem

2004-10-30 Thread Bob Showalter
Ing. Branislav Gerzo wrote: Hi all, I have little formatting problem, we have code: sub test { $sth = $dbh->prepare_cached(finish; return; } this of course doesn't work, because SQL is not at begining of the line. I tried: $sth = $dbh-

RE: easy way to add element to array

2004-10-29 Thread Bob Showalter
[EMAIL PROTECTED] wrote: > Though about using a hash but I don't have a need for a Key/Value > combination. I just need a list without duplicates. I suppose I can > define the hash keys if they don't already exists and export the keys > into an array with the keys function. Is that what you are hin

RE: each character in a string

2004-10-29 Thread Bob Showalter
[EMAIL PROTECTED] wrote: > Hi All, > I have to write a code wherein I have to access each character in a > string and compare it with '-' > > $_ = $seq1[0]; > while(/./g) { > if($1 eq '-') { > $res1[0] .= '-'; > } > else { > $res1[0] = "A"; Do you mean .= here? > } > } Are you tryin

RE: easy way to add element to array

2004-10-29 Thread Bob Showalter
Bob Showalter wrote: > If you still want to use an array, the Tie::File::Array module will > do the trick. Duh, that should be "Tie::Array::Unique". Sorry 'bout that. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http:

RE: easy way to add element to array

2004-10-29 Thread Bob Showalter
[EMAIL PROTECTED] wrote: > Hi. I'm working with an array that i'm pushing values on to, but I > don't want there to be any duplicates. Is there a perl function of an > easy way to check if an array already contains a value before I push > that value on to it? First consider whether you should be u

RE: Get all mail addresses from a domain

2004-10-29 Thread Bob Showalter
Eva Perales Laguna wrote: > Hello, > > I use the Net::SMTP module to check if a mail address is present > in a domain. I do something like this: > >my $smtp = new Net::SMTP($domain); > my $matches = $smtp->verify($usermane); > > But I would like to get all the addresses in that domain.

RE: Append on top

2004-10-29 Thread Bob Showalter
Rajesh Dorairajan wrote: > Does anyone know of a way to open a file in append mode and append on > top of the file? No, because that's not what "append mode" means. To insert data anywhere but at the end, you have to rewrite the file contents from the point of insertion forward. Or, you need to wr

RE: Recursively counting a matching pattern on a single line.

2004-10-27 Thread Bob Showalter
S.A. Birl wrote: > Given a bookmark: > > HREF="http://www.perl.com/CPAN-local/doc/FAQs/FAQ/PerlFAQ.html"; > ADD_DATE="897592292" LAST_VISIT="982769648" LAST_MODIFIED="982769648" > ID="rdf:#$rsy5Z">PERL FAQ > > > Wondering if it's possible to have 2 counters that would keep track > of the >

RE: what is something like this - $seen{$1}

2004-10-26 Thread Bob Showalter
rs wrote: > Hi, > Here's a snippet of some code from the cookbook. Hmm, time to get a new cookbook :~) > I am trying to understand what $seen{$1} is. ie where did $1 come > from, and what is in $seen{$1}, and how is the hash populated? $1 is a built-in variable that is set by capturing parens in

RE: Printing to a file

2004-10-26 Thread Bob Showalter
Brian Gunlogson wrote: > Put the MY in braces. > > SO > print MY $line; > > WOULD BECOME > print {MY} $line; Why? That fails under use strict, and is totally unecessary. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: MySQL+foreach loop.........roy

2004-10-26 Thread Bob Showalter
Chris Devers wrote: > On Tue, 26 Oct 2004, Murphy, Ged (Bolton) wrote: > > > Going back a few years here, but does an SQL statement not have to > > end in a semi-colon as above? > > I think it depends on your SQL interpreter. > > The MySQL command line interface `mysql` expect semi-colons, as d

RE: Reading from a filehandle in while-loop

2004-10-26 Thread Bob Showalter
David le Blanc wrote: ... > You are making the assumption that '' sets '$_' which is not > true. Oddly, perl makes '<>' set $_, but not ... dunno why Sorry, but that's just not correct. while () DOES set $_, as documented in perldoc perlop under the secion "I/O Operators" The OP has some o

RE: array of references

2004-10-26 Thread Bob Showalter
Scott Pham wrote: > I've been thinking about this and not sure how to approach this > problem. Say I want to create an array of 4 array references, thats > easy since I know that there will be 4 array references, how would I > do this dynamically? Say if one I only needed 2 references and > another

RE: questions

2004-10-26 Thread Bob Showalter
M. Ilyas Hassan wrote: > hi, > Could someone please help me with the following perl questions. > > #1 - Is there a way to add "days" to a date? I want > end_date=start_date+90days; where start_date is in the format > 10/25/04; the output end_date should be in the same format as well. I > was not s

Re: uninstall perlmodule

2004-10-23 Thread Bob Showalter
Bob Showalter wrote: Adam Saeed wrote: > plz tell me how to uninstall a perl module... "make uninstall" sadly doesn't work. There's a program to do it in the documentation for ExtUtils::Packlist. I've never used it, but it looks good... http://www.perlpod.com/5.8.4/

Re: uninstall perlmodule

2004-10-23 Thread Bob Showalter
Adam Saeed wrote: plz tell me how to uninstall a perl module... "make uninstall" sadly doesn't work. There's a program to do it in the documentation for ExtUtils::Packlist. I've never used it, but it looks good... http://www.perlpod.com/5.8.4/lib/ExtUtils/Packlist.html -- To unsubscribe, e-mail

Re: What search string do I use on google or perldoc so that I know how to display a specified range of lines from a file (like sed -n 24, 48p filename)?

2004-10-23 Thread Bob Showalter
Ken Wolcott wrote: A fishing pole question rather than a fish question :-) What search string do I use on google or perldoc so that I know how to display a specified range of lines from a file (like sed -n 24, 48p filename)? Zeus gave you the solution, but the background is explained in perldoc pe

RE: Module help

2004-10-22 Thread Bob Showalter
Jim Goh wrote: > Hi, > I try to use module CGI::Session:DB_File for the following: > > #!/usr/bin/perl > > use strict; > use CGI; > use lib '.'; This is unnecessary; . is a part of @INC by default. > use CGI::Session::DB_File; > ... > and the DB_File module also locate same directory as t

RE: how the print the first 7 letter of file name

2004-10-22 Thread Bob Showalter
[EMAIL PROTECTED] wrote: > I tried the way in which you have suggested > == > #!/perl -w and then later, [EMAIL PROTECTED] wrote: > this is what i tried > > #!/sbcimp/run/pd/perl/5.8.2/bin/perl -w WTF? I give up. -- To unsubscribe, e-mail: [EMAIL PROTECT

RE: how the print the first 7 letter of file name

2004-10-22 Thread Bob Showalter
[EMAIL PROTECTED] wrote: > Hi > > I tried the way in which you have suggested > == > #!/perl -w > use File::Basename; > > $FILENAME="\Developer\view_local\local_nt\FDAFDSAFDSASDFA\ASDFDAFSASDF\NewPr ocess_date_22-oct-2004.log"; > my $name = basename($FILENA

RE: how the print the first 7 letter of file name

2004-10-22 Thread Bob Showalter
[EMAIL PROTECTED] wrote: > Hi > > I have a problem > > I have > $FILENAME=C:\Developer\view_local\local_nt\FDAFDSAFDSASDFA\ASDFDAFSASDF\NewP rocess_date_22-oct-2004.log > > How to get 'NewProcess only word Use the basename() function from the File::Basename module to separate the file name from

RE: How to remove new line chars

2004-10-21 Thread Bob Showalter
Abhishek Dave wrote: > I am stucking with my problem of reading xml file , > I am trying to remove the new line chars form xml file and just > readout the xml tags. If you're trying to parse XML, use an XML parser. http://perl-xml.sourceforge.net/faq/ -- To unsubscribe, e-mail: [EMAIL PROTE

RE: simple regular expression problem

2004-10-20 Thread Bob Showalter
Steve Bertrand wrote: ... > while ($buf = ) { > # $buf now contains line of file, one per each loop of while > $buf =~ /(\w+)/; > $userName = $1; > ...do something with $userName > } This is a common error. You should not use $1 without making sure the regex did in fact match. Othe

RE: grep, and push to array if item not found

2004-10-20 Thread Bob Showalter
Steve Bertrand wrote: > > Steve Bertrand wrote: > > > I got it... > > > > > > for my $item (@clean) { > > > if (! grep ($_ eq $item, @array)) { > > > push (@array, $item); > > > print "$item\n"; > > > } > > > } > > > > FWIW, this is a FAQ (see "perl

RE: grep, and push to array if item not found

2004-10-20 Thread Bob Showalter
Steve Bertrand wrote: > I got it... > > for my $item (@clean) { > if (! grep ($_ eq $item, @array)) { > push (@array, $item); > print "$item\n"; > } > } FWIW, this is a FAQ (see "perldoc -q duplicate"). If the array elements can be compared with str

RE: LWP

2004-10-20 Thread Bob Showalter
E.Horn wrote: > i want to install LWP! > in the CPAN shell is a mistake... > I have a wrong URL ! > Can someone tell me which url i have to paste? >From within the CPAN shell, you can type o conf init To reconfigure. This will give you a menu of mirrors to choose from (you should select two o

RE: simple regular expression problem

2004-10-19 Thread Bob Showalter
Khairul Azmi wrote: > Hi all, > I am a newbie. I just need to extract the string containing the unix > account from the following text > > <[EMAIL PROTECTED]> SIZE=1024. I'm guessing you want to extract the string "user"? (But how do you know that that corresponds to a Unix account?) The followi

RE: SQL2000

2004-10-19 Thread Bob Showalter
Mark Goland wrote: ... > Are there ODBC Drivers for Unix servers ?? Yes. I've not used any personally. > Or Alternative ways of accessing MS SQL from Unix > servers ?? I use DBD::Proxy and DBI::ProxyServer for this. Works great. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional comm

RE: time manipulation

2004-10-14 Thread Bob Showalter
Patricio Bruna V. wrote: > i need to do some calc with dates, time betwen one date and other, are > any modules that you recommend? I think the DateTime family of modules is the direction things are heading. http://datetime.perl.org See also a neat (although a bit dated) high-level view at: htt

RE: network sockets.

2004-10-14 Thread Bob Showalter
Etienne Ledoux wrote: > greetings, > > I'm attempting a perl program that will listen on a port for a > connection. when a connection is made some info will be transfered > and the client will disconnect. > > I've never done this before but seem to be making some progress with > all the resources

RE: Regex:: using variables to hold replacement text

2004-10-13 Thread Bob Showalter
Radhika wrote: > Hi Bob, > I tried what you suggested and I keep getting a unitialized value > error. here is my code. If you could point me to how I could do what > William is trying to do. Sorry, I don't know what you're trying to do. Let's start over from the beginning. What are you trying to d

RE: Need help in File::Stat

2004-10-12 Thread Bob Showalter
Chandrakant Reddy wrote: ... > print " Dev = $stat->dev \n"; > > but the output is comming like this > ---OUTPUT -- > > Dev = File::Stat=ARRAY(0x150a20)->dev Method calls don't interpolate in double quotes. So you need to write it as: print " Dev = ", $stat->dev, "\n"; Or use this trick,

RE: Help creating a simple local gateway for testing HTTP::Reques t

2004-10-12 Thread Bob Showalter
Thomas Drought wrote: > Hello all, > > I was wondering if someone could help me. I have a script which send > an HTTP::Request > > I would like to be able to view what it is sending. I thought I could > just create use HTTP::Daemon for this, but I'm not getting any > response from it. I want to s

RE: usage of xerces xml parser

2004-10-12 Thread Bob Showalter
E.Horn wrote: > hello! > now i have found xerces , a parser module. If you want to process XML with Perl, why not start here to get an overview of the topic: http://perl-xml.sourceforge.net/faq/ After you study that (see esp. section 2.1) you can come back with a more focused question. > how do

RE: Logical order to read perldocs

2004-10-09 Thread Bob Showalter
Steve Bertrand wrote: > I'm trying very hard to get a good grasp on OOP, references, complex > data structures etc. > > I just ordered Learning Perl Objects, References and Modules from > amazon.ca, and have been tredging through the perldoc documentation. > > After getting into a few of the page

RE: Any way to handle Windows WM_QUERYENDSESSION message?

2004-10-08 Thread Bob Showalter
[EMAIL PROTECTED] wrote: > I have a Perl script running on Windows that functions as a wrapper > to a second program -- a compiled executable I cannot change. Within > my Perl script, I use 'system' to call the second program and wait > for it to return -- pretty basic. However, the second program

RE: Grep Weirdness

2004-10-07 Thread Bob Showalter
Kent, Mr. John (Contractor) wrote: ... > my(@ACTIVE) = qw {gid240 gid278 gid301}; > my(@LOGGED) = qw {gid306 gid240 gid278 gid301}; > > # This doesn't work, finds a match for every item in > # LOGGED, seems to be matching on "gid" but ignoring the number > foreach (@LOGGED){ > unless (grep /$

RE: Contact Form/Email Capability

2004-10-07 Thread Bob Showalter
COUNTERMAN, DANIEL (CONTRACTOR) wrote: > All, > > I have a Perl script I am running from an HTML page that will save > the output in a file called comments.txt. Is there anyway I can > email this file everytime to an email address that I provide. Be forewarned: this kind of thing tends to

RE: Open file with default application software on Windows ?

2004-10-07 Thread Bob Showalter
Bee wrote: > Hello, > > I am curious to know that if that is an existed module to open files > with it's default application just like I double click on the file > with mouse. and I do something just like this with my code : > > use defaultOpen; > defOpen 'C:\temp.gif' or die "$!" ; # Then the i

RE: Mod Perl Helper Functions

2004-10-05 Thread Bob Showalter
James Taylor wrote: > I posted this to the mod_perl list 2 days ago, but it seems a bit > inappropriate there as the discussion is much more > advanced than my question... That and I haven't gotten a response, so > sorry for the crosspost :) > > I'm running apache 1.3.x with the associated version

RE: OT: Email syntax validation

2004-10-04 Thread Bob Showalter
Gunnar Hjalmarsson wrote: > Randal L. Schwartz wrote: > > Again, why aren't you just using Email::Valid? > > I have already explained that: > http://www.mail-archive.com/beginners%40perl.org/msg62450.html Interesting; if you visit that link, www.mail-archive.com evidently doesn't properly match R

RE: Removing many files and subdirectories under a folrder

2004-10-04 Thread Bob Showalter
Bob Showalter wrote: > John wrote: > > can the above be done with one perl function? > > No; you need to write a script. Oops, I guess you can do it in one function. Sorry 'bout that :~) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EM

RE: Removing many files and subdirectories under a folrder

2004-10-04 Thread Bob Showalter
John wrote: > can the above be done with one perl function? No; you need to write a script. You might look at http://ppt.perl.org/commands/rm/index.html for an implementation of rm(1) in Perl. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: Passing options to command in a system call

2004-10-01 Thread Bob Showalter
Jan Eden wrote: > Hi, > > I try to call wget using system like this: > > system("wget -O /dev/null", "http://janeden.org/test/file.txt";); > > This does not work: > > Can't exec "wget -O /dev/null": No such file or directory at > ./wgetrec.pl line 6. > > Ok, so how about this: > > system("wg

RE: Trouble with m///g

2004-09-30 Thread Bob Showalter
Chap Harrison wrote: > Hi, > > I'm trying to extract all four-digit numbers from a string in one fell > swoop, but I can't seem to come up with the proper regexp. This is my > first time using /g in a match so maybe there's a trick I'm missing. > > For example, the string > > " aa 4

RE: Regex:: using variables to hold replacement text

2004-09-30 Thread Bob Showalter
William Lewis Brown wrote: > Hi, > I have a need to store replacement text for a regex > substitution in a variable. In other words, I have code in a perl > script like so:: > > $foo =~ s/(.*)bar(.*)/$replacement/g; > > The $replacement string needs to contain a "reference" to $1. In >

RE: how to open a file with 666 permission

2004-09-30 Thread Bob Showalter
Gunnar Hjalmarsson wrote: > Bob Showalter wrote: > > Chris Devers wrote: > > > Maybe the program is a code generator that produces other files > > > which should be executable (I can't remember anyone doing this, > > > but there's no reason why it

RE: how to open a file with 666 permission

2004-09-29 Thread Bob Showalter
Chris Devers wrote: > On Wed, 29 Sep 2004, Bob Showalter wrote: > > > Gunnar Hjalmarsson wrote: > > > > > > If the program, for some reason, requires that a file it creates > > > has certain permissions, isn't it better to have the program set >

RE: POSIX module

2004-09-29 Thread Bob Showalter
Errin Larsen wrote: > When I use the following in my code, it runs and > works fine: > > use POSIX 'setsid'; > use POSIX 'errno_h'; > use POSIX ':sys_wait_h'; > > However, when I try to combine those into one line: > > use POSIX qw/setsid errno_h :sys_wait_h/; > > Then I get the follow

RE: How to access first key of "Hash of Hash"

2004-09-29 Thread Bob Showalter
Edward Wijaya wrote: > I thought 'keys' are only for simple hash. All hashes are simple hashes, if you think about it. Each entry is a string key and a scalar value. There is no other kind of hash. Now that scalar value can be a *reference* to something else, and you get a bit of syntactic sugar

RE: POSIX module

2004-09-29 Thread Bob Showalter
Errin Larsen wrote: > Hi Perlers, > > I've seen a lot of tutorial or example code dealing with the POSIX > module that does something like this: > > use POSIX ':sys_wait_h'; > > What does the ':' mean/do in the above line? It's called a "tag" and is typically used to import a "basket" of symb

RE: how to open a file with 666 permission

2004-09-29 Thread Bob Showalter
Gunnar Hjalmarsson wrote: > Bob Showalter wrote: > > You need to set umask to 0 before creating the file. > > > > But don't do that. It's inadvisable to mess with the umask in a > > program, IMO. > > Why would that be inadvisable? The spirit of umask i

RE: how to open a file with 666 permission

2004-09-29 Thread Bob Showalter
[EMAIL PROTECTED] wrote: > Hai! > My requirement is to open file with 666 permissions. You need to set umask to 0 before creating the file. But don't do that. It's inadvisable to mess with the umask in a program, IMO. If the user wants to create files as 666, let him set the umask before running

RE: Opening file($ARGV) with Getopt - failing

2004-09-28 Thread Bob Showalter
Errin Larsen wrote: > So, what was the justification for changing 'use vars' to 'our'? I don't know, but I suspect it's because "our" is a complement to "my". Same syntax (no silly qw() business), same lexical scoping, etc. You're correct. our() should be used and 'use vars' should be considered

RE: Problem iterating over diamond (while)

2004-09-28 Thread Bob Showalter
Edward Wijaya wrote: > Thanks a lot for your reply Bob. > but can you be more specific: > > > You need to either close and reopen the file, or > > rewind the file using seek() before you can re-read the data. > > What I mean is: for ( ...blah... ) { seek(INFILE, 0, 0); # <--- re

RE: Problem iterating over diamond (while)

2004-09-28 Thread Bob Showalter
Edward Wijaya wrote: > Hi, > > Suppose I have a data file that contain these lines: > output1 > output2 > > when I run the code below > with: perl mycode.pl -f datafile > it gives: > > Trial 1 > output1 > output2 > Trial 2 > > > instead of: > > Trial 1 > output1 > output2 > Trial 2 > output1

Re: Daemon that starts other Daemons

2004-09-24 Thread Bob Showalter
Errin Larsen wrote: > Ok ... so with some research and playi^H^H^H^H^Htesting I've found the > answer to what's really been bothering me. If you *really* want to understand the nuts and bolts of all this, Stevens' _Advanced Programming in the UNIX Environment_ is a must. http://www.amazon.com/exe

RE: :Oracle installation Woes

2004-09-22 Thread Bob Showalter
[EMAIL PROTECTED] wrote: > Ok here is the deal, our admin is trying to install DBD::Oracle for > me to access one of our affiliates databases. The oracle "instant > basic client" and "sqlplus" has been installed as well as > GetOpt::Long. > > The installations all went well except for DBD::Oracle

Delete all hash entries except for a specific list

2004-09-21 Thread Bob Showalter
Consider, my %hash = ( foo => 1, bar => 2, baz => 3, qux => 4, ); I would like to remove all the entries in the hash except for 'bar' and 'qux'. (Actual hash has other entries which can vary at runtime. I know that I only want to keep 'bar' and 'qux' however). Here'

RE: simple windows process list

2004-09-21 Thread Bob Showalter
JP wrote: > The object of the code below is to output a list of space seperated > fields with PID, username and process. The code generates te correct > output. My guess is that my perl code can be smaller. Who dares? unpack() with 'A' is handy for extracting and removing trailing blanks in one st

RE: Moving between hashes 2.

2004-09-17 Thread Bob Showalter
Michael Robeson wrote: Don't post MIME or HTML to the list. Plain text only. > > I have two sets of data that have been stored in hashes. The first > hash > has amino-acid (protein) sequence data. The second hash has the > corresponding DNA sequence of those amino-acids: > > > Hash 1 > key: v

RE: how to get and convert time

2004-09-17 Thread Bob Showalter
Franklin wrote: > Hello: > My operating system is freebsd and its time is GMT time which I can't > change. How can I write a perl script to get the exact > time(Hour,minute,second) and change it to US ET? As John said, the internal clock is always UTC. On FreeBSD, you use the tzsetup(8) program to

RE: failure with: system("dir /b"); exec("dir /b"); `dir /b`

2004-09-17 Thread Bob Showalter
A B C wrote: > Greetings, > > Does anyone know how to get perl to run windows > commands like "dir /b". Specifically, perl doesn't > accept any type of argument switches. I've tried > system(), exec() and backticks in my script. > > However, If I remove the switch, for example: > system("dir"). T

RE: insert data with Perl into multiple MySQL tables

2004-09-17 Thread Bob Showalter
Maxipoint Rep Office wrote: > How insert data with Perl into multiple MySQL tables? You need multiple INSERT statements. Use a transaction if they all need to complete or fail together. I don't use MySQL, so I don't know how transactions work for it specifically, but typically you just use a combi

RE: time managing

2004-09-15 Thread Bob Showalter
Budi Santosa wrote: > Chris and Scott, > Thanks for your information. Unfortunately, I use > windows-based Komodo as my Perl platform. > Is there any cron function in this platform? Windows has an "at" scheduler that, frankly, sucks big time. Here's a perl cron for windows: http://cronw.sourcefor

RE: output to one changing line

2004-09-15 Thread Bob Showalter
JupiterHost.Net wrote: > Hello list, > > I've seen this done, but am not sure what its called or where to start > looking... > > Instead of the output of a script via CLI being: > > # perl script.pl > line1 > line2 > line3 > etc > # > > I'd like the line to change as it runs, sort of an animate

RE: Reading input and Word completion

2004-09-13 Thread Bob Showalter
Manish wrote: > Hi, > > I was wondering if this is the wrong list for this. Or is the > description too vague? Your example doesn't show evidence that you've read the docs for Term::Complete. Start there. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PRO

RE: Conceptual questions about 'pack'

2004-09-13 Thread Bob Showalter
Bee wrote: > > > In case, I am doing something like a log with User v > > > TimesOfSignIn. So, user name will set as 30 char long, and the > > > Signin times is about in scope of a normal integer. I wanna make > > > this a simple DB for this but not a list of single files for each > > > user. So I

RE: Undefined subroutine [...] called at [...] though sub and rou tine exist

2004-09-13 Thread Bob Showalter
Schlabach, Torsten wrote: > Dear list, > > I have a problem with Perl and I have no idea at all how to search > for it. > > I have a CGI script that is calling a perl module. One function in > that module uses a sub which is defined only later in the source, but > there is a forward declaration

RE: SMTP

2004-09-13 Thread Bob Showalter
Anish Kumar K. wrote: > HI > > I am using Active PERL for WINDOWS. How will I know > SMTP is Installed on the system...Can you suggest a small program for > SMTP Client or server? If you want to send mail, I suggest installing MailTools (ppm install MailTools), which gives you the Mail::Send mo

Re: general question about variable and array

2004-09-08 Thread Bob Showalter
xaver biton wrote: > Hi, > > how do I insert the values of variables of a function in a array which > ist out of the scope of the function, e.g > > I've a find function and I want insert the values results of the find > function in an array: > > > my @array;

RE: Foo (Bar)

2004-09-08 Thread Bob Showalter
Bob Showalter wrote: > http://www.catb.org/~esr/jargon/html/M/metasyntactic-variable.html Oops, sorry. Didn't realize someone already posted that link. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http

RE: Foo (Bar)

2004-09-08 Thread Bob Showalter
jason corbett wrote: > As a newbie, I have seen the statement "foo (bar)" mentioned in books > and and even on this site. I haven't yet seen what this actually mean > as I can assume that its just for examples. If I am wrong please > explain in detail what this is about. http://www.catb.org/~es

RE: regex on the command line

2004-09-08 Thread Bob Showalter
Errin Larsen wrote: > Hi Perl-Buddies, > > I'm wondering how to get a regex into my code at run-time. I mean in > a command line like this: > > # my_perl_program "foo(\w|and|or)+bar" foobar.txt > > and in my code I want to be able to search the foobar.txt file with > the regex found in the quot

RE: Hi

2004-09-03 Thread Bob Showalter
Anish Kumar K. wrote: > Hi Welcome. > > I am Beginner in perl..Can any one sugges some sample programs of > PERL where I can build the skills. Please let me know at the > earliest. Thanks Start at http://learn.perl.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-

RE: Perl Script for accessing XML file

2004-08-31 Thread Bob Showalter
view before diving in. > > -Original Message- > From: Bob Showalter [mailto:[EMAIL PROTECTED] > Sent: Tuesday, August 31, 2004 11:16 AM > To: Pothula, Giridhar; [EMAIL PROTECTED] > Subject: RE: Perl Script for accessing XML file > > Pothula, Giridhar wrote: > > Hi

RE: Could this be made shorter and cleaner?

2004-08-31 Thread Bob Showalter
Gavin Henry wrote: > P.S. I am now a programmer or a scripter, I am not sure is perl is > programming or scripting? I think programming. You are a programmer. No such thing as a "scripter". You're using a scripting language, which simply means you don't have to use a compiler and linker to produc

RE: Perl Script for accessing XML file

2004-08-31 Thread Bob Showalter
Pothula, Giridhar wrote: > Hi All, > > I am trying to get a code snippet for the client side Perl script in > an ASP page which accesses XML file residing on the server. Hmm, not sure what you mean by "client side". Both ASP and Perl are server-side technologies. Anyway, you might want to start

<    1   2   3   4   5   6   7   8   9   10   >