Re: Getting data from hashes

2004-01-21 Thread John W. Krahn
Robin Sheat wrote: > > I have a method 'getNetwork' that returns a hash. Actually, subroutines in perl return lists. > I can quite happily go: > %reply = $network->getNetworkError('net','data','data2'); > my $baseErr = $reply{error}; > > however, I can't go: > my $baseErr = $network->getNetwork

Re: how to initialize an array of unknown size to 0?

2004-01-21 Thread John W. Krahn
Vaishnavi Krishnamurthy wrote: > > Hello, Hello, > Can anyone tell me how I can do the following - all the elements in my > array of unkown size should be initialised to the value 0 ? @array = (0) x @array; John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED]

RE: how to initialize an array of unknown size to 0?

2004-01-21 Thread Charles K. Clarkson
vaishnavi krishnamurthy <[EMAIL PROTECTED]> wrote: : Can anyone tell me how I can do the following - all the : elements in my array of unknown size should be initialized : to the value 0? Assuming your array has only one dimension: @array = (0) x @array; HTH, Charles K. Clarkson -

RE: threads in perl

2004-01-21 Thread Igor Ryaboy
Hi, Thanks for your help, 1 more question related to your advice Ok, How can I kill exec after it was started in different thread? Igor -Original Message- From: david [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 21, 2004 8:10 PM To: [EMAIL PROTECTED] Subject: RE: threads in perl I

Getting data from hashes

2004-01-21 Thread Robin Sheat
I have a method 'getNetwork' that returns a hash. I can quite happily go: %reply = $network->getNetworkError('net','data','data2'); my $baseErr = $reply{error}; however, I can't go: my $baseErr = $network->getNetworkError('net','data','data2')->{error}; nor: my $baseErr = ${$network->getNetworkEr

Re: Upload files and directories

2004-01-21 Thread Andrew Gaffney
Robin Sheat wrote: On Wed, Jan 21, 2004 at 11:49:53PM -0500, Lone Wolf wrote: I am in dire need of a script that will upload everything from one server to another one that I can cron. Right now I have to do it by hand and with more and more updates being done to the site, I need a way While not a

RE: how to initialize an array of unknown size to 0?

2004-01-21 Thread chetak.sasalu
Hi Vaish, The size of your "unknown sized" array can be found using the function scalar. Here is one way to do it. #! /usr/bin/perl -w my @arrUnknownSize = (1,3,4); for(my $i=0; $i < scalar(@arrUnknownSize); $i++) #try using the condition $i <= scalar(@arrUnknownSize) and watch da fun! {$ar

Re: Upload files and directories

2004-01-21 Thread Robin Sheat
On Wed, Jan 21, 2004 at 11:49:53PM -0500, Lone Wolf wrote: > I am in dire need of a script that will upload everything from one > server to another one that I can cron. Right now I have to do it by > hand and with more and more updates being done to the site, I need a way While not a Perl solution

Upload files and directories

2004-01-21 Thread Lone Wolf
I am in dire need of a script that will upload everything from one server to another one that I can cron. Right now I have to do it by hand and with more and more updates being done to the site, I need a way to do it seamlessly. One that checks dates against each other would be cool too. i.e.: i

Re: Join strings problem

2004-01-21 Thread drieux
On Jan 21, 2004, at 6:46 PM, Luinrandir Hernsen wrote: I thanks you very much for reply and all 3 ways do work. unfortunately I did not state the situation completely. $Building is to = the variable $EW0NS0 thru $EW10NS10 This is so I can set certain variables like my $EW5NS5="TEST.gif"; to show a

how to initialize an array of unknown size to 0?

2004-01-21 Thread vaishnavi krishnamurthy
Hello, Can anyone tell me how I can do the following - all the elements in my array of unkown size should be initialised to the value 0 ? thanks, vaish. -- ___ Sign-up for Ads Free at Mail.com http://promo.mail.com/adsfreejump.htm -- T

Re: Join strings problem

2004-01-21 Thread drieux
On Jan 21, 2004, at 2:26 PM, Luinrandir Hernsen wrote: #!/usr/local/bin/perl use strict; use warnings; my ($Building, $row, $col); { dan's gonna kill me for that one... 8-) } print qq|Content-type: text/html\n\n|; my $EW5NS5="TEST.gif"; ##this is the string I need to build. print qq|\n|; for ($

Join strings problem

2004-01-21 Thread Luinrandir Hernsen
Hallo and thank in advance. what am I doing wrong? I'm new to Perl. my Building string is not being built. is it that I need to declare the joined strings a string?How? Lou #!/usr/local/bin/perl print qq|Content-type: text/html\n\n|; my $EW5NS5="TEST.gif"; ##this is the string I need to build.

Re: On import v. Just Do It.

2004-01-21 Thread drieux
On Jan 20, 2004, at 9:19 AM, Dan Muey wrote: Oops left out a sentence sorry for the delay. p0: yes, one can use an import() from a package to make something like the scam of 'require in line' Why is it a scam if that's what I want to do for myself? I presume we are talking about

Re: Program to write code

2004-01-21 Thread Dan Anderson
On Wed, 2004-01-21 at 17:32, Marcelo wrote: > Hi, could anyone recommend a good program to write code, currently using notepad. I really like Emacs, but it has a high learning curve. Check out: http://www.xemacs.org/ And, of course, not everyone likes Emacs. Better check out ViM as well: http:

Program to write code

2004-01-21 Thread Marcelo
Hi, could anyone recommend a good program to write code, currently using notepad. Thanks a lot in advance. Marcelo

Re: Help with fileglob: Unix vs. Windows?

2004-01-21 Thread Dan Anderson
On Wed, 2004-01-21 at 11:52, McMahon, Chris wrote: > Hello... > This script works fine on Unix: > > #!/usr/local/bin/perl > use warnings; > use strict; > my $dir = "/usr/home/admin"; > my @files = glob ("$dir/*"); > print @files; > > > But this script doesn't do right in Windows: > > u

RE: format localtime()

2004-01-21 Thread Bob Showalter
rmck wrote: > I cant get localtime to print in "mm-dd- hh:mm:ss" , I keep > getting it like so "Sun Dec 28 03:35:19 2003" POSIX::strftime gives you complete control over the format. use POSIX 'strftime'; print strftime('%m-%d-%Y %H:%M:%S', localtime), "\n"; perldoc POSIX -- To unsubscr

Re: double-log-tail

2004-01-21 Thread Joel Newkirk
Cool, thanks - both look promising. j On Mon, 2004-01-19 at 14:47, Wiggins d'Anconia wrote: > Joel Newkirk wrote: > > I'm interested in tailing two logs (qmail) simultaneously, and > > interleaving the data in something approaching chronological sequence, > > as well as dealing with logfile rotat

RE: format localtime()

2004-01-21 Thread Dan Muey
> Hi > > I have the following script that sucks in a file and converts > unix timestamp to human readable.. > > The Goal is to do a search and replace of unix time to the > format i need. But I'm just trying to get it to print in the > format i need first... > > I cant get localtime to prin

format localtime()

2004-01-21 Thread rmck
Hi I have the following script that sucks in a file and converts unix timestamp to human readable.. The Goal is to do a search and replace of unix time to the format i need. But I'm just trying to get it to print in the format i need first... I cant get localtime to print in "mm-dd- hh:m

Loading libraries into a static Perl

2004-01-21 Thread Shawn Sharp
Hey, I am trying to create a stand alone (static) program in Perl (no shared libraries). I have tried perlcc -L /lib perl.pl but am not have any luck. This will create an executable but you still need the shared libraries. I have also typing in the path of each library (ie perlcc -L /lib/libp

Re: capturing f1,f2, key presses instantlly

2004-01-21 Thread Tim
use Term::ReadKey; ReadMode 'cbreak'; $key = ReadKey(0); ReadMode 'normal'; At 09:34 AM 1/22/04 +0200, you wrote: hello all, do any one of you know how can i capture f1 and f2 keypresses, and responding to them instantly without pressing enter ?? thanks

capturing f1,f2, key presses instantlly

2004-01-21 Thread rhlinux
hello all, do any one of you know how can i capture f1 and f2 keypresses, and responding to them instantly without pressing enter ?? thanks

Re: IO File Problems

2004-01-21 Thread wolf blaum
> hi there, hi | servus, > 2) now i have to merge this strings with strings from a file. in this file > there are many configuration sections. > the section i need looks like this: > > [WHITELIST] > [EMAIL PROTECTED] > [EMAIL PROTECTED] > [EMAIL PROTECTED] > > so i need to get all adresse under t

RE: Help with fileglob: Unix vs. Windows?

2004-01-21 Thread Perry, Alan
On Wednesday, January 21, 2004 10:53, McMahon, Chris queried: > >But this script doesn't do right in Windows: Modify the code as shown, and it should work: >use warnings; >use strict; >my $dir = "E:\\Documents and Settings\\cmcmahon\\Desktop"; You have to escape the spaces, and for some reas

RE: threads in perl

2004-01-21 Thread david
Igor Ryaboy wrote: > I have no problem to alarm when timeout occurs in specific thread, I have > a difficulty to abort a "system" command in that thread. in that case, fork a different process in your thread, replace system with exec and use the pid of the newly created process to abort itself w

Re: use strict and filehandles

2004-01-21 Thread B McKee
On Tuesday, January 20, 2004, at 10:34 AM, B McKee wrote: Hi All, I'm having trouble understanding what use strict is trying to tell me. If I have run this program ...snipped open(MESSAGE, "$datafile") or die "Cannot open datafile: $!"; while (!eof(MESSAGE)) { $page = new CGI(MESSAGE); ...mor

tie STDOUT to TextUndo

2004-01-21 Thread lobach
Is there anyway to tie STDOUT to a TK::TextUndo widget or somehow call a save method for the TK::Text widget? Ideas and suggestions welcome. Thanks, Steve.. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Help with fileglob: Unix vs. Windows?

2004-01-21 Thread McMahon, Chris
Hello... This script works fine on Unix: #!/usr/local/bin/perl use warnings; use strict; my $dir = "/usr/home/admin"; my @files = glob ("$dir/*"); print @files; But this script doesn't do right in Windows: use warnings; use strict; my $dir = "E:\\Documents and Settings\\cmcmahon\\

Book review: Network Programming With Perl by Lincoln Stein

2004-01-21 Thread McMahon, Chris
http://www.amazon.com/exec/obidos/tg/detail/-/0201615711/qid=1074699239/sr=1 -1/ref=sr_1_1/102-8963439-4561724?v=glance&s=books Drieux and others mentioned this book a couple of weeks ago. I just got a copy and spent yesterday afternoon exploring several parts of interest. I'm impressed:

Re: Loop Runners

2004-01-21 Thread John W. Krahn
Amit Phatak wrote: > > To run through a loop there more than one ways (a lot actually!) in PERL. It is Perl for the language and perl for the interpreter but never PERL. > The ones I'm aware of are: To run through @array > > #1 > $size = @array; > for($i=0;$i<$size;$i++) > { >print "$arra

Re: File::Copy

2004-01-21 Thread Jeff 'japhy' Pinyan
On Jan 21, zentara said: >copy( "$ARGV[0]", "$ARGV[0]\.bak" ); >chmod ($mode, "$ARGV[0]\.bak"); >print "Backup completed.\n"; Why do you backslash the . in "$ARGV[0]\.bak" but not in "completed.\n"? Long story short, you don't need to \ the . in either case, and you don't need quotes around $ARG

Re: RadioButton question

2004-01-21 Thread lobach
Figured it out.. in case anyone was wondering... sub OnSetNodeDialog { # Construct the DialogBox my $setNode = $mw->DialogBox( -title=>"Set Node Dialog", -default_button => "Cancel", -buttons=>["OK", "Cancel"] ); # Now we need to add a Label widget so we can show some text $setNod

RE: Re: Re: Sub not working as it should

2004-01-21 Thread Traeder, Philipp
You don't need to be sorry - it's the right choice ;-) Philipp > -Original Message- > > I am sorry I am migrating over to perl (love the built > in debugger) > --- Saadat Saeed <[EMAIL PROTECTED]> wrote: > > Thanks for the quick reponse - looks like I confuse > > my > > vbscript skills a

Re: Re: Re: Sub not working as it should

2004-01-21 Thread Saadat Saeed
I am sorry I am migrating over to perl (love the built in debugger) --- Saadat Saeed <[EMAIL PROTECTED]> wrote: > Thanks for the quick reponse - looks like I confuse > my > vbscript skills a bit... I am new to perl and am > migrating over to vbscript! > > Regards > > > --- Jeff 'japhy' Pinyan <[

Re: Re: Sub not working as it should

2004-01-21 Thread Saadat Saeed
Thanks for the quick reponse - looks like I confuse my vbscript skills a bit... I am new to perl and am migrating over to vbscript! Regards --- Jeff 'japhy' Pinyan <[EMAIL PROTECTED]> wrote: > On Jan 21, Saadat Saeed said: > > > opendir(DIR,"$line\\c\$\\Docume~12") or > >errornos($line

Re: Sub not working as it should

2004-01-21 Thread Jeff 'japhy' Pinyan
On Jan 21, Saadat Saeed said: > opendir(DIR,"$line\\c\$\\Docume~12") or >errornos($line,1,NEW); [snip] >sub errornos($machine,$errorno,FIL) { > print FIL "error $errorno $machine"; >} >For some reason the above code doesn't pass parameters >to my subroutine? How & why or am I m

Sub not working as it should

2004-01-21 Thread Saadat Saeed
#!C:/Perl/bin/perl.exe #use IO::File; $file = "comp.lst"; $new = "ee.lst"; open (FH, "$file") or die "Cannot open file $file $!"; open(NEW, ">> $new") or die "can't open $new: $!"; while($line = ) { chomp $line; opendir(DIR,"$line\\c\$\\Docume~12") or errornos($lin

Re: usage of Net::Telnet

2004-01-21 Thread lobach
This is what I do.. The only difference I see is that you haven't logged on.. my $rmhost = new Net::Telnet (Host => $nodesrch, Timeout => 100 ); $rmhost->login($uname_EGATE, $passwd_EGATE); $cat_command='cat ./data/journal/chopler'; @cat_result=$rmhost->cmd($cat_command);

IO File Problems

2004-01-21 Thread PerlDiscuss - Perl Newsgroups and mailing lists
hi there, couse of my missing skills with filehandling i would be happy if you provide me help. this is my problem: 1) I´m getting a list of email adresses (strings) from a database into an array - o.k. no problem ... 2) now i have to merge this strings with strings from a file. in this file th

IO File Problems

2004-01-21 Thread PerlDiscuss - Perl Newsgroups and mailing lists
hi there, couse of my missing skills with filehandling i would be happy if you provide me help. this is my problem: 1) I´m getting a list of email adresses (strings) from a database into an array - o.k. no problem ... 2) now i have to merge this strings with strings from a file. in this file th