RE: Newbie Module Install question...

2002-06-05 Thread John Edwards
The answer is in your question... http://www.roth.net/perl The Win32::Daemon module is available from Dave Roth's site. HTH John -Original Message- From: Ron Powell [mailto:[EMAIL PROTECTED]] Sent: 05 June 2002 14:03 To: perl beginners Subject: Newbie Module Install question... So,

RE: Strange total from adding 2 numbers

2002-05-23 Thread John Edwards
No. I've just tried --- $a = 68288455.49; $b = 67947269.62; $c = $a - $b; print $c; --- and also get a result of 341185.8699 Weird. John -Original Message- From: Timothy Johnson [mailto:[EMAIL PROTECTED]] Sent: 23 May 2002 17:01 To: '[EMAIL PROTECTED] '; '[EMAIL PROTECTED] ' Su

RE: FIle upload

2002-05-20 Thread John Edwards
agrh. sig from hell... Post some example code. What platform are you running on? What webserver? Have you got any error messages? How about the server logs? Is there anything relevant there? Are you using the cgi.pm module? John -Original Message- From: Arran [mailto:[EMAIL PROTECTE

RE: Logging details

2002-05-13 Thread John Edwards
You could either redirect all STDERR output to a file, or pass all error info to a sub routine. For the second method you could do... if (system ($cmd)) { &fatalError("Error $!\n"); } sub fatalError { my $error = shift; open ERROR ">>error.txt" or die "Can't append to error.txt: $!";

Name resolution from IP

2002-04-30 Thread John Edwards
ot; It works on the LAN, but not across a router to the remainder of our WAN. Any ideas? -- John Edwards IT Support Runecraft Leeds 0113 2206317 07961 356186 www.runecraft.co.uk -- Disclaimer: These are my opinions and probably not those of my employer, since I developed them long before I

RE: grep a array element..

2002-04-16 Thread John Edwards
You mean something like this? --- use strict; my @array = qw(car bus caravan bike cart); my $lookfor = "car"; foreach my $element (@array) { if ($element =~ /$lookfor/) { print "Found a match!! => $element\n"; } else { print "$lookfor doesn't match $element\n"; } }

RE: problem with directory listing

2002-04-11 Thread John Edwards
Sorry. That should have been prepend. -Original Message- From: John Edwards [mailto:[EMAIL PROTECTED]] Sent: 11 April 2002 12:47 To: 'richard noel fell'; [EMAIL PROTECTED] Subject: RE: problem with directory listing Whitespace, whitespace, whitespace. Right, got that ove

RE: problem with directory listing

2002-04-11 Thread John Edwards
Whitespace, whitespace, whitespace. Right, got that over with now let's look at your code (formatted so it's readable) #!/usr/local/ActivePerl-5.6/bin/perl5.6.1 -w use strict; my $mw; my $menubar; my $algebra; my @file_array; my $dir_to_process = "/home/rfell/mathprogram"; opendir DH, $dir_to_

RE: Strip Carriage Returns

2002-04-04 Thread John Edwards
How did you move the file? File copy? FTP? *nix systems use line feeds at the end of lines in text files. Windows systems use LF\CR. Or the other way round. That's the cause of your problem anyway. One way of solving it is to FTP the file to the box in asci mode, I believe. This might help htt

RE: find files with .jpg extensions in directories

2002-04-04 Thread John Edwards
Take a look at this code I just found for the directory recursion http://www.geodata.soton.ac.uk/~hrz/personal/perl_scripts/?link=view_source. html&script=recurse.pl For the second question, your until loop quits out as soon as the extension is correct, leaving you with no input data. Try this i

RE: Opens / create file if necessary

2002-04-04 Thread John Edwards
Why open the file until enter has been pressed? Try something like this $file = "c:/test.txt"; while (1) { &stuff; } sub stuff { print "Enter some text for the file (q to quit): "; $input = ; print "\n"; exit if $input eq "q\n"; open FILE, ">>$file" or die "Can't appe

RE: Array question...

2002-03-28 Thread John Edwards
try if (defined @array) { # do something } else { # It's not been created, do something else } HTH John -Original Message- From: Michael D. Risser [mailto:[EMAIL PROTECTED]] Sent: 28 March 2002 13:55 To: [EMAIL PROTECTED] Subject: Array question... OK here's the problem: I

RE: search

2002-03-27 Thread John Edwards
http://www.m-w.com/home.htm Oh, you mean in Perl?? Give more details. Are you looking for a word in a file? In an input string? $text = "this is a test string"; if ($text =~ /test/) { print "Found 'text' in string"; } John -Original Message- From: Allison Ogle [mailto:[EMAIL PROTE

RE: Batch creation of thumbnails

2002-03-26 Thread John Edwards
Try the GD module. Here is some code I have for creating thumbnails (untested as it's stripped down from a bigger script). Thumbnails have a _ prepended to them. They're not great thumbs, there is no anti aliasing done on them. For better image handling you'll need to look at the ImageMajick (sp??

RE: delta time/date

2002-03-06 Thread John Edwards
Yeah, use the Date::Calc module or maybe Date::Manip. John -Original Message- From: Dittrich G. Michael [mailto:[EMAIL PROTECTED]] Sent: 06 March 2002 17:13 To: [EMAIL PROTECTED] Subject: delta time/date I try to find a quick and uncomplicated way to calculate the difference between on

RE: TIMTOWDI Was: RE: some questions about for, foreach

2002-03-01 Thread John Edwards
Yeah, yeah. So I made a typo. :p -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: 01 March 2002 18:00 To: [EMAIL PROTECTED] Subject: TIMTOWDI Was: RE: some questions about for, foreach It is really sad when people can't get their MLA (Multi-Letter Acronym) cor

RE: some questions about for, foreach

2002-03-01 Thread John Edwards
I think it lies in the history of programming. Traditionally for loops look like this (when written in perl) for($i=1; $i<=100; $i++){ print "$i\n"; } while foreach loops look like this. @array = qw(one two three); foreach (@array) { print "$_\n"; } Even though you can do for (@a

RE: help to delete a line

2002-02-27 Thread John Edwards
You need to increment the counter *inside* that block as well. Otherwise, $counter will remain 12 and you will go into an infinite loop. if ($counter == 12) { $counter++ next; } $counter++; HTH John -Original Message- From: Joanne Fearon [mailto:[EMAIL PROTECTED]] Sent:

RE: iteration default variable

2002-02-27 Thread John Edwards
I don't think there is one. You can maintain a counter for this purpose though. my $counter; for (@answer) { #do something ... print "On element index $counter\n"; $counter++; } John (Ex OUP...) -Original Message- From: KAVANAGH, Michael [mailto:[EMAIL PROTECTED]

RE: Perl help

2002-02-27 Thread John Edwards
ailto:[EMAIL PROTECTED]] Sent: 27 February 2002 14:55 To: John Edwards Subject: RE: Perl help The log file is actually a *.dat file and I would be writing it to an Excel spreadsheet. I am on a Windows 2000 operating system. You'll have to forgive me because I don't know anything yet a

RE: sort order of hash keys

2002-02-26 Thread John Edwards
directly. thats why i would like to get the key / values in the same order as they are in the hashtable file. whats the name of that hash modules? :o) martin On Tue, Feb 26, 2002 at 10:28:16AM -, John Edwards wrote: > hash keys are stored unsorted. If you have the following hash > &

RE: sort order of hash keys

2002-02-26 Thread John Edwards
hash keys are stored unsorted. If you have the following hash %test = ( one => 1, two => 2, three => 3); and print out the hash key/value pairs. foreach $key (keys %test) { print "$key is $test{$key}\n"; } you will find they don't come out in the s

RE: file size

2002-02-22 Thread John Edwards
Upload via FTP? Via a web based form? 18 questions left... John -Original Message- From: anthony [mailto:[EMAIL PROTECTED]] Sent: 22 February 2002 14:22 To: [EMAIL PROTECTED] Subject: file size Hi, I have an upload script, and i want to check the file size before it uploads. Any sugg

RE: convert array to integer

2002-02-22 Thread John Edwards
$num=$num-0; You don't need to do this in Perl. There is no distinction between an integer and a string. It's just a scalar. This is something you would have to do in Javascript though. John -Original Message- From: walter valenti [mailto:[EMAIL PROTECTED]] Sent: 22 February 2002 12:12

RE: convert array to integer

2002-02-22 Thread John Edwards
You want to take a sum of all the array elements?? You don't need to convert the array to an interger. Perl handles this internally. For instance, if you want to treat a text string as a number, or a number as a text string, perl allows it. This does what you are after use strict; my @array = q

RE: Regular Expression

2002-02-21 Thread John Edwards
$req =~ s/\r//g ; # This is replacing all carriage return special characters with nothing globally. # s/(replace)\r(carriage return special char)/(with nothing i.e delete them)/g(globally. i.e for every match in the string, not just the first)/; $req =~ s/([^\n]{72,72})\n([^\n]{1,71})\n([^\n]{1,7

RE: [Q] Validating Forms?!

2002-02-21 Thread John Edwards
You might have more luck asking this in the Perl CGI Beginners list. I haven't got any scripts that do this, but I know it's possible. See http://learn.perl.org to subscribe to the CGI list. John -Original Message- From: Bhanu Prakash [mailto:[EMAIL PROTECTED]] Sent: 21 February 2002 11

RE: [Q] Validating Forms?!

2002-02-21 Thread John Edwards
I would do this using javascript within the form. Then when the field loses focus you can validate it. This means the form doesn't have to be submitted before the user is alerted of a problem. For extra robustness you can also validate the submitted results in the perl script and return the user

RE: How to count lines in an output file

2002-02-19 Thread John Edwards
open(INFILE, "rmaccess1.txt") or die "Can't open rmaccess1.txt: $!"; open(OUTFILE, ">outfile.txt") or die "Can't create outfile.txt: $!"; # ALWAYS check for errors when opening file handles. It's a good habit to get into. print "Enter name of the Media file to analyse: "; # I'd keep the above on

RE: Illegal seek

2002-02-19 Thread John Edwards
Sorry, I can't help with this issue. It was just something to try based on your last post. I've cc'd this back to the list. Please keep the discussion there. Thanks John -Original Message- From: Tony McGuinness [mailto:[EMAIL PROTECTED]] Sent: 19 February 2002 15:08 T

RE: Illegal seek

2002-02-19 Thread John Edwards
OK. Maybe I've missed something here, but why are you storing a single string in an array?? Try this $arg = "$Basedir/ftpscr"; if (system($arg)) { die "cannot execute ftpscr $!"; } John -Original Message- From: Tony McGuinness [mailto:[EMAIL PROTECTED]] Sent: 19 February 2002 14:55 To:

Sorted off list (was: help with html)

2002-02-19 Thread John Edwards
Just FYI, this was sorted off list. Chris, see what happens when you take things off list... John -Original Message- From: Chris Zampese [mailto:[EMAIL PROTECTED]] Sent: 19 February 2002 11:42 To: John Edwards Subject: Re: help with html Thanks John, I will rewrite my script

RE: help with html

2002-02-19 Thread John Edwards
"I want to send an html document via email to people that have blocked html" Why? Can't you send a text file? What's special about this HTML page? Does it contain links to web URLs? If so have you considered that they may not have web access? "The main thing that I want this for is the ability t

RE: Size of Array

2002-02-18 Thread John Edwards
The terminology you are looking for is multidimensional array. I.e you have an array wherin each element is an array (actually a reference to an anonymous array IIRC), not a scalar. You can find the size of the array by asking for it in a scalar context, not a list context. For example my @arra

RE: Help me out

2002-02-15 Thread John Edwards
open(IN,'STNAMES.DAT') or die "Can't open STNAMES.DAT: $!"; # open student consolidated names open(OUT,'>results') or die "Can't create results: $!\n"; # result file open output $counter = 1; # Use a better variable name than c. What does c stand for?? I'm assuming counter foreach () { # Now REA

RE: $foo

2002-02-15 Thread John Edwards
lol. This should help explain. http://whatis.techtarget.com/definition/0,,sid9_gci212139,00.html When you see something like $foo = $_; It means that someone is taking the value of the default variable ($_) and assiging in to another scalar. In this case, $foo, but it could just as easily be

RE: finding .jpg or any .extention file

2002-02-13 Thread John Edwards
Why bother with reading the file in again and again?? Just do this 1)Open a file, create if necessary, read contents into @original array 2)Prints you name into the file every time someone presses "enter", AND appends to @original 3)Print a newline 4)Seek to the beginning of the file without clo

RE: finding .jpg or any .extention file

2002-02-13 Thread John Edwards
from the command line" John how long are you into perl? Cheers Bruce >>> John Edwards <[EMAIL PROTECTED]> 02/13/02 05:32PM >>> OK. Using the code from before #!/usr/local/bin/perl -w # first example... use strict; # declarations... my @files = `ls -F`; my %fil;

RE: Printing values from hashes

2002-02-13 Thread John Edwards
Are you sure that $VALUE is recieving a value from the split?? If so your code should print out the $VALUE value (you may want to pick some better var names...) John -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: 13 February 2002 15:42 To: [EMAIL PROTECTED] S

RE: Perl regular expresions HELP!

2002-02-13 Thread John Edwards
foreach my $f ( @files ){ # Iterate through the @files array, foreach iteration set the value of $f to the next element of @files if( $f =~ /private/ ){ next; } # If the scalar $f contains the text "private", then stop this iteration and move onto the next one chomp $f; #

RE: How do I get trim or rounding on a float number ?

2002-02-08 Thread John Edwards
Ah. Reading this I realised that while the number you gave (24.97) will round to 25.00 using sprintf, not all number will round as expected using that methos. Instead you can use this (which does appear to work). $number = "12.345"; # Round this number $n = 2;

RE: How do I get trim or rounding on a float number ?

2002-02-08 Thread John Edwards
Well, do you want to round or trim? The number you mention rounded to 2dp would be 25.00. Trimmed to 2dp would be 24.99. To round the number you could do this $number = "24.97"; $rounded = sprintf "%.2f",$number; print $rounded; To trim you could do $number = "24.97"; ($rounded) = $num

RE: Renaming files with Perl

2002-02-08 Thread John Edwards
http://www.google.com/search?sourceid=navclient&q=perl+rename+file HTH John -Original Message- From: Troy May [mailto:[EMAIL PROTECTED]] Sent: 08 February 2002 14:50 To: Perl Beginners Subject: Renaming files with Perl Hello, I posted a question about this a couple days ago and only

RE: HELP! : To write a script that reads numbers from STDIN and print on STDOUT.

2002-02-07 Thread John Edwards
Yeah. I can write code to do that. Thanks for asking. This has the hallmarks of a homework assignment... John -Original Message- From: Bruce Ambraal [mailto:[EMAIL PROTECTED]] Sent: 07 February 2002 16:31 To: [EMAIL PROTECTED] Subject: HELP! : To write a script that reads numbers from S

RE: Never had this happen before!

2002-02-07 Thread John Edwards
Magic?? Why don't you start by posting the errors that perl reports. It will save us having to guess... John -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: 07 February 2002 15:42 To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: Never had this happen

RE: select text

2002-02-05 Thread John Edwards
"Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a life time." -Chinese proverb This is a beginners list, no? I thought we were here to help people learn, not provide them with solutions that may work, but they don't know how... John -Origina

RE: select text

2002-02-05 Thread John Edwards
You can use the following code... $email = 'Name LastName <[EMAIL PROTECTED]>'; $email =~ /<([\w@.]+)>/; $email = $1; print $email; As you seem relatively new to this, here is a breakdown $email = 'Name LastName <[EMAIL PROTECTED]>'; # Just define the data for this demo $email =~ /<([\w@.]+)>/

RE: distinguishing positive and negative values

2002-02-05 Thread John Edwards
This should work. I've used an array to simulate your text files. The first regex (as you already had) matches the lines without a - sign. I've modified your second regex to look for the - sign, thus it picks up negative values only. @array = ("3034364717283459322a-15.32zM042001H", "3

RE: to know about new computer h\w

2002-02-05 Thread John Edwards
www.google.com Stop wasting our time and bandwidth. That post was so off topic, badly worded and misconceived that your "thanking you" comes across as pure sarcasm... John -Original Message- From: sanilkumar [mailto:[EMAIL PROTECTED]] Sent: 05 February 2002 10:01 To: [EMAIL PROTECTED] S

RE: Newbe looping questions

2002-02-05 Thread John Edwards
You are right to use the while loop. However, if you are continually running the same command and storing that value in $foo, how can you expect it to change? Does the external program change it's return value? Can you explain in more detail what you are trying to achieve. This example shows how

RE: Checking if a file exists.

2002-02-04 Thread John Edwards
$file = "/path/to/file.txt"; if (-e $file) { print "Yep, that file exists\n"; } else { print "Nope. Not there\n"; } For more on the file test operators see perldoc -f -X HTH John -Original Message- From: Ned Cunningham [mailto:[EMAIL PROTECTED]] Sent: 04 February 200

RE: still not catching error

2002-02-01 Thread John Edwards
Try $result = `rsh $plant /u1/bin/forkit '/u1/bin/work.pl'`; print $result; You are storing the output of the rsh... command into the variable. You can now run a regex on that to check for success/failure. I don't know what the output should be but as an example... $result = `rsh $plant /u1/b

RE: Debug some simple code

2002-01-31 Thread John Edwards
Change until ($number=999) { and if ($number=999) { to == 999. You are assigning the value 999 to the $number var in both cases, not checking if it is equal to 999. Simple mistake, we've all made it ;) HTH John P.S Here is how I would code this script. use strict; my ($number, $total);

RE: Writing to a file

2002-01-31 Thread John Edwards
What OS are you running? I've included a script that uses Win32::OLE to interface with Excel. You'll need to be on a Win32 machine, with Excel installed. There is also a module called Spreadsheet::WriteExcel which is platform independant, but I have not had any experience using this. HTH John

RE: html entity conversion... one liner?

2002-01-31 Thread John Edwards
Why *must* it be a one liner. I think my suggestion is easier to understand for someone having to maintain your code. If there is no other reason than "I want a one liner" to do this on one line, then why not do it on two?? Just because it is possible in one line, doesn't mean it's the best approa

RE: Modifying/Additng text in a file

2002-01-31 Thread John Edwards
If the file is fixed in this format, then you could do a check for ) and write the line after that is found. Then continue with the file. For example open IN, "c:/input.txt" || die "Can't open c:/input.txt: $!"; open OUT, ">c:/new.txt" || die "Can't create c:/new.txt: $!"; while () {

RE: html entity conversion... one liner?

2002-01-31 Thread John Edwards
$item =~ s//>/g; Well. It is on one line ;) John -Original Message- From: KAVANAGH, Michael [mailto:[EMAIL PROTECTED]] Sent: 31 January 2002 14:06 To: '[EMAIL PROTECTED]' Subject: html entity conversion... one liner? I thought it would be good to be able to do this: $item = ""; $ite

RE: How to prevent redefining a variable with use strict?

2002-01-28 Thread John Edwards
You could use a constant instead. -- code -- use strict; use constant INDEX => 5; # I'm assuming $i refers to an index. Use more descriptive variable names... print ("Value of index" . INDEX . "\n"); INDEX = 6; -- end code -- Run that and you will get the following error. Can't modify const

RE: please Help ! Database connection

2002-01-25 Thread John Edwards
using the module, I never bother with print "Content-type: text/html\n\n"; as it won't display errors. Just my 0.02c John -Original Message- From: Jon Molin [mailto:[EMAIL PROTECTED]] Sent: 25 January 2002 14:48 To: John Edwards Cc: 'mb'; [EMAIL PROTECTED]

RE: please Help ! Database connection

2002-01-25 Thread John Edwards
This looks like your script isn't returning the correct HTML headers. It's not a database connection fault. I would strongly suggest using the CGI.pm module. This provides an easy interface to all things CGI. All this to the top of your script. use CGI qw(:standard); use CGI::Carp qw(fatalsToBro

RE: simple perl question

2002-01-25 Thread John Edwards
n the results. Here is how it should look /a([\d\.]+)z/ John -Original Message- From: John Edwards [mailto:[EMAIL PROTECTED]] Sent: 25 January 2002 09:16 To: 'Stuart Clark'; Perl List Subject: RE: simple perl question This line $total += /a([\d.]+)z/; is adding the numbe

RE: simple perl question

2002-01-25 Thread John Edwards
This line $total += /a([\d.]+)z/; is adding the number of successful matches (1 for each iteration in this case) of the regex to $total. There are three lines, three matches. You need to store the result of the regex as a list value, not scalar. while () { ($match) = /a([\d.]+)z/;

RE: file handle not working in NT

2002-01-24 Thread John Edwards
Have you tried if( $^O eq "MSWin32"){ open(INPUT, "../SampleConfig.xml") or die "Can't open .../SampleConfig.xml: $!"; } else { open(INPUT, "SampleConfig.xml") or die "Can't open SampleConfig.xml: $!"; } Note forward slash... John -Original Message- From: K.Srinivas [ma

RE: Press any key to continue...

2002-01-24 Thread John Edwards
Is this on windows?? If so: system("pause"); HTH John -Original Message- From: Dmitri Zakharov [mailto:[EMAIL PROTECTED]] Sent: 23 January 2002 19:47 To: [EMAIL PROTECTED] Subject: Press any key to continue... Hi everybody; Here's a perl newbie problem: I'm wondering how could I su

RE: %

2002-01-24 Thread John Edwards
It's a hash. You can use it in the following way. -- code -- %daysPerMonth = ('Jan' => 31, 'Feb' => 28, 'Mar' => 31); print "March has $daysPerMonth{'Mar'} days in it\n"; -- end code -- It allows you to look up a value using a key. In this instance, the value is 31, and the key is Mar. Take

RE: What is wrong with this?

2002-01-22 Thread John Edwards
"errors out via the web" What error message do you get? Is there anything in the Apache error logs that's relevant? Does the web server account have write access to the ipaccess.log file? John -Original Message- From: Michael Pratt [mailto:[EMAIL PROTECTED]] Sent: 22 January 2002 11:44

RE: regular expression help

2002-01-22 Thread John Edwards
Escape the brackets like so. s/\(locked\)//; John -Original Message- From: David Samuelsson (PAC) [mailto:[EMAIL PROTECTED]] Sent: 22 January 2002 09:37 To: '[EMAIL PROTECTED]' Subject: regular expression help Hello! if i have this line ROXETTE_PC_SW_R1D08 (locked) and just want to

RE: Exchange mailbox size

2002-01-21 Thread John Edwards
]] Sent: 21 January 2002 15:10 To: 'PERL beginners' Subject: RE: Exchange mailbox size Ideally, I would like to log these to a file for reporting, so thought PERL would be the best way of doing this. THanks Simon -Original Message----- From: John Edwards [mailto:[EMAIL PROTECTED]

RE: to die, croak, or confess

2002-01-21 Thread John Edwards
You can do this die "\n"; The newline means die will not print anything out to STDOUT. (other than a new line...) HTH John -Original Message- From: Alex Harris [mailto:[EMAIL PROTECTED]] Sent: 21 January 2002 14:22 To: [EMAIL PROTECTED] Subject: to die, croak, or confess I need to p

RE: Regex Assistance

2002-01-18 Thread John Edwards
ne. I think it should work, but let us know if it doesn't. Good Luck! Joshua Colson Systems Administrator Giant Industries, Inc. (480) 585-8714 [EMAIL PROTECTED] -Original Message- From: John Edwards [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 17, 2002 10:43 AM To: Perl Beginn

Regex Assistance

2002-01-17 Thread John Edwards
Hi group. I have the following snippet of code. It's not working and I've been going round in circles trying to figure out why. I need a routine that will look at the filename, if that filename already exists, then add a (1) to the end. I've got the checking for existance sorted, it's the gener

RE: Thumbnail images on-the-fly

2002-01-16 Thread John Edwards
I think you'll need to look at the image magik module for creating the thumbnails. I've looked at this in the past, and come away with headaches, but I believe it's the right tool for the job. Good luck John -Original Message- From: Scott R. Godin [mailto:[EMAIL PROTECTED]] Sent: 16 Janu

RE: excluding comments in a line

2002-01-14 Thread John Edwards
How about splitting the line. @lines = ("foo=bar # stuff", "bar=foo # more stuff"); foreach (@lines) { my ($line) = split(/\s*#/); print "$line\n"; } John -Original Message- From: Yacketta, Ronald [mailto:[EMAIL PROTECTED]] Sent: 14 January 2002 17:45 To: Beginners (E-m

RE: vCal (try2)

2002-01-14 Thread John Edwards
Maybe these will help... http://www.imc.org/pdi/pdiprodslist.html http://www.w3.org/People/Bos/Plan2vcs/plan2vcs John -Original Message- From: Booher Timothy B 1stLt AFRL/MNAC [mailto:[EMAIL PROTECTED]] Sent: 14 January 2002 14:58 To: '[EMAIL PROTECTED]' Subject: vCal (try2) I sent

RE: Help with File::Find

2002-01-11 Thread John Edwards
Something I just found via a google search... foreach (@_) { $min = $_ if $min > $_; } $min now holds the smallest value of the array. BTW, shouldn't line 21 be write $fileref STDOUT? I've not gone over the code, but if you are looking for the smallest array value, then only writing out

RE: Data manipulation problem

2002-01-11 Thread John Edwards
OK. I've been over all your code. Here is the way I would do this. N.B I've not checked for errors or typos. It's commented to explain the changes. Basically instead of having to grep the second file for every iteration of the foreach loop, you initialize a hash with the data from the second file

RE: Data manipulation problem

2002-01-11 Thread John Edwards
Try changing to this. printf "emaildata is $emaildata[0]"; $emaildata[0] is using the element in a scalar format @emaildata[0] is using the element in an array format, which is converted to scalar by perl when printing out in this case. The array only has the one element [0]. When you take an ar

RE: Using SMPT on Windows NT

2002-01-11 Thread John Edwards
I regularly use a nice script, available here http://www.liquidsilver.com/scripts, called Form2Mail. It's intended to provide a generic interface to mail data from a web form. It had a nice example of using sockets to send mail. This should be portable between OSs as all mail code is done via a s

RE: Manageable code

2002-01-10 Thread John Edwards
I prefer to lay out code like this myself. if ($foo) { $foo--; &stuff; } if ($bar) { $baz += $foo } else { $baz = $foo < 9 ? 3 : 1; } There is less vertical whitespace (by putting the opening brace on the same lin

RE: perl sandbox creation

2002-01-10 Thread John Edwards
So you've not tried to solve this on your own yet? Have you got any sample code? I'd suggest taking the first few lines from your file and playing with that as the data file until you get a working script. Then you only have to process a few lines to see if your code is working or not. It also ma

RE: pull line #1 from a file

2002-01-08 Thread John Edwards
That should work. The big problem with it is you are creating an array which contains the contents of the whole file. Then using only the first element of that array and ignoring the rest. Depending on the size of your file you could be wasting huge chunks of memory. -Original Message- Fr

RE: Searching for a book...

2002-01-07 Thread John Edwards
Try to keep lines shorter? I think Stanislav's post was more than adequate for the list. Especially as it would appear that English isn't his first language. Take a look at the FAQ section 2.3, bullet point 1 and chill out. /John ;) -Original Message- From: Jon Molin [mailto:[EMAIL PROT

RE: Searching for a book...

2002-01-07 Thread John Edwards
Are you after a reference book? If so I'd suggest the Perl Black Book. It's not your standard reference, more a mixture of reference and cookbook. It explains how functions work by solving a small real life problem using it and is very useful

RE: your my last hope on this cgi programming question

2002-01-07 Thread John Edwards
ess to the cgi bin > at > >all.. > > > >anyone know a free server for a cgi-bin? > > > > > >--- John Edwards <[EMAIL PROTECTED]> wrote: > > > >>You should start out by investigating the CGI.pm > >>module for Perl. Does your > &g

RE: test and question

2002-01-07 Thread John Edwards
You mean the timestamp on the file? http://www.google.com/search?sourceid=navclient&q=perl+read+file+timestamp To compare dates http://www.google.com/search?sourceid=navclient&q=perl+compare+dates HTH John P.S If you ask a question on the list, you should be prepared for the answer to go bac

RE: @$

2002-01-07 Thread John Edwards
It means treat the value in $row as a reference to an array. If you print out $row you will get something that looks like this. ARRAY(0x369ab0) Try altering your code to this foreach $ts ($te->table_states) { print "Table (", join(',', $ts->coords), "):\n"; foreach $row ($ts->rows) {

RE: your my last hope on this cgi programming question

2002-01-07 Thread John Edwards
You should start out by investigating the CGI.pm module for Perl. Does your web host allow Perl scripts and do they have the CGI.pm module available for use? Once you've got some simple CGI scripts up and running it isn't too hard to do what you are after. You just need to use CGI.pm to display a

RE: Computer connected to the internet?

2002-01-04 Thread John Edwards
How about pinging several hosts that have a pretty good chance of being up. www.microsoft.com, www.netscape.com, www.ibm.com, etc, etc. You could also ping your local gateway address. If all fail (except for the router as the link may be down beyond that, but if the ping to the router fails, then

RE: HELP - finding a float while reading a file

2002-01-04 Thread John Edwards
123 45 -23 56 <-3.45 145 555 112 -12.0 -2.55 >From those lines, is it just the -3.45 and -2.55 that you are after? If so then the following should work. my @lines = ('123 45 -23 56 <-3.45', '145 555 112 -12.0 -2.55'); foreach (@lines) { /(-?\d*\.?\d+)$/; print "Found $1\n"; }

RE: add text to the end of a word. HELP!!

2002-01-02 Thread John Edwards
You need to open the file, save the contents in memory, then close the file. Now re-open the file for writing and print the saved contents to it making the changes as needed. This is fine for non crictical files that are small (once you open the file for write, it's contents are deleted so if your

RE: Counting the size of an array reference

2001-12-20 Thread John Edwards
Or, better still sub MySub { my ($aref)=@_; $count = $#{$aref}; return $count; } John -Original Message- From: Tomasi, Chuck [mailto:[EMAIL PROTECTED]] Sent: 20 December 2001 16:02 To: '[EMAIL PROTECTED]' Subject: Counting the size of an array reference

RE: Counting the size of an array reference

2001-12-20 Thread John Edwards
How about sub MySub { my ($aref)=@_; $count = @{$aref}; return $count - 1; } HTH John -Original Message- From: Tomasi, Chuck [mailto:[EMAIL PROTECTED]] Sent: 20 December 2001 16:02 To: '[EMAIL PROTECTED]' Subject: Counting the size of an array reference

RE: Shift question...

2001-12-20 Thread John Edwards
shift returns the first value of the array. When no array is defined it operates on the default array @_ You will most likely see the line you mention as the first line of a subroutine. E.g &call_sub('John'); sub call_sub { my $name = shift; print "Name is $name\n"; } What's ha

RE: I need your help

2001-12-20 Thread John Edwards
That can be viewed as two problems with the same answer. When you find word1, replace with your new word. When you find word2, replace with nothing, hence deleting it. Tip, look up docs on the s/// or substitute method HTH John -Original Message- From: Jose Vicente [mailto:[EMAIL PROTE

RE: Cant figure out how key's value in a hash is created in program example.............

2001-12-20 Thread John Edwards
I'll try $count {$word} = $count {$word} + 1; The $count refers to a hash called %count. As you are working with only one element of that hash (the key/value pair with the key of $word), you reference the element as a scalar (hence the $, not %). It's still refering to the hash, but not the whol

RE: :FTP

2001-12-17 Thread John Edwards
Take a look at the Net::FTP docs. There's a function in the module called mdtm which returns the modified timestamp of the remote file. Query that, then download if it matches your criteria. HTH John -Original Message- From: Mike [mailto:[EMAIL PROTECTED]] Sent: 17 December 2001 13:39 T

RE: today's date....

2001-12-05 Thread John Edwards
Try this. $thisday = (Sun,Mon,Tue,Wed,Thu,Fri,Sat)[(localtime)[6]]; $thisdate = (localtime)[3]; if ($thisdate == 1 || $thisdate == 21 || $thisdate == 31) { $thisdate .= "st"; } elsif ($thisdate == 2 || $thisdate == 22) { $thisdate .= "nd"; } elsif ($thisdate == 3 || $thisdate ==

RE: Re[2]: create an NT user with Perl

2001-12-04 Thread John Edwards
Or take a look at the Win32::Lanman module. He asked for a solution in Perl and there is one... -Original Message- From: Maxim Berlin [mailto:[EMAIL PROTECTED]] Sent: 04 December 2001 12:37 To: [EMAIL PROTECTED] Subject: Re[2]: create an NT user with Perl Hello Jorge, Tuesday, December

RE: delete a line of a file

2001-11-26 Thread John Edwards
open the file, create a new file, read each line of the source file, check if it starts with subnet, if not write it to the new file. When you are done, close both files, delete the source file (if you are sure your script has made the right changes), then rename the output file to the source. So

RE: adding a word

2001-11-26 Thread John Edwards
Try something like this open IN, "/path/to/file.txt" or die "Can't find input file: $!"; open OUT, ">/path/to/ouput.txt" or die "Can't create output file: $!"; $add_this = " node"; while () { chomp; print OUT "$_$add_this\n"; } close IN; close OUT; -Original Message- F

  1   2   3   >