Re: How do I get simple random numbers?

2003-02-01 Thread Dr. Poo
On Saturday 01 February 2003 03:18 pm, R. Joseph Newton wrote: > Jamie Risk wrote: > > I'm thinking I could open up "/dev/urandom/" but that hardly seems > > portable. > > Hi Jamie, > > Remember the principle of KISS. > Ahem..excuse me; What is the principle of KISS? Thanks. :) Also, for the rand

RE: Threads

2003-02-01 Thread Beau E. Cox
Hi dan - > -Original Message- > From: dan [mailto:[EMAIL PROTECTED]] > Sent: Saturday, February 01, 2003 3:47 PM > To: [EMAIL PROTECTED] > Subject: Re: Threads > > > I tried that, but it's still doing as before. I'll give you a more fuller > outline of what there is, and what I want it to

Open file

2003-02-01 Thread [EMAIL PROTECTED]
Hi list, Sorry i'am a newbie of Perl. My problem is that I'll modifier a text file in silent mode with Perl. So I have a file for example pippo.txt with 100 line of words. My goals is to found a particular line of char with the first character # and erase it. (before I'll make a backup of all cha

Re: equivalent of static vars?

2003-02-01 Thread Bob Showalter
christopher j bottaro wrote: > hello, > what are the equivalent of static vars in c code? for instance... > > void myfunc() { > static int first_call = 1; > > if (first_call) { > /* do some intialization of something */ > first_call = 0; > } > } > > i want to be able to do something like that in p

Re: equivalent of static vars?

2003-02-01 Thread John W. Krahn
Christopher J Bottaro wrote: > > hello, Hello, > what are the equivalent of static vars in c code? for instance... > > void myfunc() { > static int first_call = 1; > > if (first_call) { > /* do some intialization of something */ > first_call =

Re: Threads

2003-02-01 Thread dan
I tried that, but it's still doing as before. I'll give you a more fuller outline of what there is, and what I want it to do, maybe it may become clearer... I'm using a socket, and it loops in a sub. while () { # etc.. } once the code has finished connecting to the server, it runs another sub,

Re: reading files

2003-02-01 Thread Bob Showalter
mario kulka wrote: > Before I upload a file with a random name I would like to make sure > that another file with the same name doesn't already exist. Is there > a way to look for a specific $name file within a directory (on UNIX). Be aware that algorithms using -e or similar to check for the exis

equivalent of static vars?

2003-02-01 Thread christopher j bottaro
hello, what are the equivalent of static vars in c code? for instance... void myfunc() { static int first_call = 1; if (first_call) { /* do some intialization of something */ first_call = 0; } } i want to be able to do something like tha

RE: Threads

2003-02-01 Thread Beau E. Cox
Hi - > -Original Message- > From: dan [mailto:[EMAIL PROTECTED]] > Sent: Saturday, February 01, 2003 6:46 AM > To: [EMAIL PROTECTED] > Subject: Threads > > > Hey again, > > I have another problem, this time involving threads. Here's what > I intend to > do, and what I have in code (roughly

Re: Even more regex

2003-02-01 Thread R. Joseph Newton
Wiggins d'Anconia wrote: This example only matches when *all* of the possibles are supplied, > which is explicitly what he stated he didn't have. Thanks, Sorry, careless reading. I'd thought he only wanted to extract certain values from a full string. This should be a little more robust: #!

Re: Use of uninitialized value in pattern match (m//) at test.pl line 85.

2003-02-01 Thread R. Joseph Newton
chad kellerman wrote: > Hi guys, > >How can I get around this "warning" > > Use of uninitialized value in pattern match (m//) at test.pl line 85. Hi Chad, Please send your code again with line 85 marked. You have that information in front of you, while we are at a disadvantage. Thanks, J

Re: Even more regex

2003-02-01 Thread Wiggins d'Anconia
R. Joseph Newton wrote: dan wrote: I have a string, which is to represent a length of time, say 3d4h45m12s which can be variable, so you may end up with just 3m, or 5h2m, etc. What I need to do, is to take this string, and split it up into $days, $hours, $minutes etc, and then create that amoun

Re: Help with input streams

2003-02-01 Thread R. Joseph Newton
Jason Wozniak wrote: > while (<>) { > @files = ; > } Hi Jason, the <> operator loads $_, and moves the file pointer to the next line. That's why you miss the first line in your progam when it is overwritten by . Instead, try: while (<>) { push(@files, $_); } Joseph -- To

Re: Even more regex

2003-02-01 Thread R. Joseph Newton
dan wrote: > I have a string, which is to represent a length of time, say 3d4h45m12s > which can be variable, so you may end up with just 3m, or 5h2m, etc. What I > need to do, is to take this string, and split it up into $days, $hours, > $minutes etc, and then create that amount of time in second

Re: file's MIME type

2003-02-01 Thread Wiggins d'Anconia
mario kulka wrote: I found the following in a book when trying to find out the file's MIME type, but it doesn't work. Am I missing something obvious? Thanks. M. code: #!/usr/bin/perl -W use CGI ':standard'; $file = param('music_file'); $info = uploadInfo ($file); $type = $info -> {'Content-Ty

Re: How do I get simple random numbers?

2003-02-01 Thread R. Joseph Newton
Jamie Risk wrote: > I'm thinking I could open up "/dev/urandom/" but that hardly seems portable. Hi Jamie, Remember the principle of KISS. #!/usr/bin/perl -w use strict; my $bits = $ARGV[0]; my $Random = int (rand(2**$bits)); print "$Random\n"; Joseph -- To unsubscribe, e-mail: [EMAIL PRO

Re: newbie stuck in a hash

2003-02-01 Thread R. Joseph Newton
Pam Derks wrote: > my %all_keys = (); > > foreach my $key (keys %hash1) { > $all_keys{$key} = 1; > } > > foreach my $key (keys %hash2) { > $all_keys{$key} = 1; > } Hi pam, It strikes me that you are throwing away information here. Even if that information is not needed in the immediate con

Re: Use of uninitialized value in pattern match (m//) at test.pl line 85.

2003-02-01 Thread Rob Dixon
Chad Kellerman wrote: > Hi guys, > >How can I get around this "warning" > > Use of uninitialized value in pattern match (m//) at test.pl line 85. > > For some reason I always get driveNum=2. > > I am using warinig and strict in my code.. > [snip code] > > Line 86 below I presume you me

Re: uploading files

2003-02-01 Thread R. Joseph Newton
mario kulka wrote: > Hi, > After I click on "submit" and point to the cgi there is a period of time > before the cgi finishes running and loads the next page. If the script is > simple and takes short amount of time everything is great. But what if > that's not the case? What if the script (while

Re: still needing help

2003-02-01 Thread R. Joseph Newton
Todd W wrote: > here is a section of the html 4 spec: > http://www.w3.org/TR/html4/appendix/notes.html#ampersands-in-uris ... > The current version of CGI.pm uses: > > my(@pairs) = split(/[&;]/,$tosplit); ... Thanks, Todd, This is like gold. Joseph -- To unsubscribe, e-mail: [EMAIL PROTE

RE: Use of uninitialized value in pattern match (m//) at test.pl line 85.

2003-02-01 Thread NYIMI Jose (BMB)
> -Original Message- > From: chad kellerman [mailto:[EMAIL PROTECTED]] > Sent: Saturday, February 01, 2003 6:38 PM > To: [EMAIL PROTECTED] > Subject: Use of uninitialized value in pattern match (m//) at > test.pl line 85. > > > Hi guys, > >How can I get around this "warning" > >

RE: Use of uninitialized value in pattern match (m//) at test.pl line 85.

2003-02-01 Thread NYIMI Jose (BMB)
C:\WINNT>perldoc -q warnings Found in C:\Perl\lib\pod\perlfaq7.pod How do I temporarily block warnings? If you are running Perl 5.6.0 or better, the "use warnings" pragma allows fine control of what warning are produced. See the perllexwarn manpage for more de

Use of uninitialized value in pattern match (m//) at test.pl line 85.

2003-02-01 Thread chad kellerman
Hi guys, How can I get around this "warning" Use of uninitialized value in pattern match (m//) at test.pl line 85. For some reason I always get driveNum=2. I am using warinig and strict in my code.. if ($pong->ping($mslRef{$server}{ip})) { #check for 2 drives

Threads

2003-02-01 Thread dan
Hey again, I have another problem, this time involving threads. Here's what I intend to do, and what I have in code (roughly). Basically, I want my program to run normally, but also have a while (1) { ... } loop going at the same time. This checks for things such as expired objects. The loop chec

Re: Replacing a string in a bunch of files

2003-02-01 Thread Rob Dixon
Jason Wozniak wrote: > I was attempting to produce the file list by piping the output of a > find command. See my previous email for the problem I'm having with > that... > > I guess the question I would have is how you are producing the list in > "myfiles"? > > in my case I suppose I could go to

Re: Help with input streams

2003-02-01 Thread Rob Dixon
Jason Wozniak wrote: >> >> I am trying to put together a search and replace program that I can >> string together with typical unix shell commands like find, and >> grep. However, I can't get past the initial read of the files I >> want to process, using the diamond operator. I lose the first >>

Re: More regex required!

2003-02-01 Thread dan
Hey, this works, just 1 thing it doesn't do, but should. 1) this.is.a.string.to.match.with 2) this.is.another.string.to.match.with 3) this.is.a.totally.with.different.string I've changed string 3 just to demonstrate this. What I want to be able to do, along with what's already been said, is to do

Re: reading files

2003-02-01 Thread Michael Kelly
Hi Mario, On Sat, Feb 01, 2003 at 06:35:55AM +, mario kulka wrote: > Before I upload a file with a random name I would like to make sure that > another file with the same name doesn't already exist. Is there a way to > look for a specific $name file within a directory (on UNIX). if( -e $fil

perltidy was File instead of here doc as my input

2003-02-01 Thread Alan C.
Didn't find much on it in my ActiveState module. But applicable here: http://search.cpan.org/author/SHANCOCK/Perl-Tidy-20021130/docs/tutorial.pod Has/installed batch file into perl\bin folder. Got it working! Thanks! -- Alan. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional comma

FW: Help with input streams

2003-02-01 Thread Jason Wozniak
Well as a followup to my own email.. This works where the while loop does not, so at least now I've found a way to pipe the output of the unix find command into my program :) I'm still not sure I understand why though... chomp(@files = <>); I had also tried: while (<>) { @files = $_; }

RE: Replacing a string in a bunch of files

2003-02-01 Thread Jason Wozniak
I was attempting to produce the file list by piping the output of a find command. See my previous email for the problem I'm having with that... I guess the question I would have is how you are producing the list in "myfiles"? in my case I suppose I could go to the directory that has the glog.log

Re: How do I get simple random numbers?

2003-02-01 Thread Michael Kelly
On Fri, Jan 31, 2003 at 03:51:04PM -0500, Jamie Risk wrote: > I'm looking around, and I see "Quantum::Entanglement" which looks like > overkill; I'd like to generate, 8/16/32 bit random numbers. > > - Jamie rand() seems like what you're looking for. perldoc -f rand -- Michael [EMAIL PROTECTED]

Help with input streams

2003-02-01 Thread Jason Wozniak
I am trying to put together a search and replace program that I can string together with typical unix shell commands like find, and grep. However, I can't get past the initial read of the files I want to process, using the diamond operator. I lose the first argument in the list every time. I put

Re: reading files

2003-02-01 Thread Paul Johnson
On Sat, Feb 01, 2003 at 06:35:55AM +, mario kulka wrote: > Before I upload a file with a random name I would like to make sure that > another file with the same name doesn't already exist. Is there a way to > look for a specific $name file within a directory (on UNIX). To check whether a fi

Regarding Encode::Guess

2003-02-01 Thread viswanathan sundararajan
Hi all, I want to add the encoding scheme of my language in the Encode.pm module.My language has so many encoding schemes which all come under ISO-8589 standard. How can i do this? So that it can guess my language encoding too. Any pointer regarding this is welcome. Thanx in advance, visu