Re: Help needed with setting up a SMTP connection

2001-06-14 Thread Me
Can't help much, but, fwiw: These two are definitely completely wrong: > $mailer->open ( 'From' => 'me <[EMAIL PROTECTED]>', > 'To' => 'you <[EMAIL PROTECTED]>', > 'Subject' => 'Test' > ) ; > > $mailer->open ( From => 'me <[EMAIL PROTECTED]>', >

Re: Help needed with setting up a SMTP connection

2001-06-14 Thread Michael Fowler
On Thu, Jun 14, 2001 at 08:30:14AM +0200, Adrienne Kotze wrote: > $mailer = Mail::Mailer->new ("smtp", "smtp.mydomain.com") ; This should be: $mailer = Mail::Mailer->new("smtp", Server => "smtp.mydomain.com"); This is the cause of your warning. > $mailer->open ({ From => 'me <[EMAIL PROTE

RE: testing on email characters

2001-06-14 Thread Jeff Yoak
At 02:17 PM 6/13/01 -0700, Peter Cornelius wrote: >I've never used Email::Valid but it may be a good way to solve the problem, >I'd be impressed if it actually catches all valid addresses (and very >happy). I've always just accepted that there would be some special cases >that wouldn't be caught

RE: regex on hash keys?

2001-06-14 Thread John Edwards
Can you post some example code and an example of the data you are using and what you are trying to achieve. Maybe there is a better way to do what you are after. John -Original Message- From: Hans Holtan [mailto:[EMAIL PROTECTED]] Sent: 13 June 2001 23:23 To: [EMAIL PROTECTED] Subject: r

mystery

2001-06-14 Thread Sally
I got the following code from a tutorial. When I uploaded (FTP) it as a perl file I got more errors than you could shake a stick at. When I uploaded it as an html file it sort of worked, ie it printed out the "Hello world" but it printed out everything else too. I think I understand why it worked

RE: mystery

2001-06-14 Thread John Edwards
What operating system does the webserver run? If it's Unix or similar you need to set the properties of the file so that all user can execute the file. Normally you'll want to chmod the file to a value of 755. See this for some more details http://www.waferthin.com/manual/manual5.html The server

RE: A Term::ReadKey question -- keep cursor put!

2001-06-14 Thread Pate Mark-marpate1
What, you don't find spinny cursors interesting anymore? Strange that you should bring this up, only last week I was using the spinny cursor concept to explain to a colleague how to continually auto-scoll text in a browser window using the technique similar to my @windmill=("\\", "\|", "\/",

RE: mystery

2001-06-14 Thread John Edwards
Can you give me the URL of this file? -Original Message- From: Sally [mailto:[EMAIL PROTECTED]] Sent: 14 June 2001 10:41 To: John Edwards Subject: RE: mystery That has all been done, and the file was uploaded in ascii mode and not binary -Original Message- From: John Edwards [m

Re: Help needed with setting up a SMTP connection

2001-06-14 Thread Adrienne Kotze
Michael Fowler wrote: > > On Thu, Jun 14, 2001 at 08:30:14AM +0200, Adrienne Kotze wrote: > > $mailer = Mail::Mailer->new ("smtp", "smtp.mydomain.com") ; > > This should be: > > $mailer = Mail::Mailer->new("smtp", Server => "smtp.mydomain.com"); Thanx, this works great. So it would appear

RE: mystery

2001-06-14 Thread John Edwards
OK. Do you have access to the server logs? Have you tried naming the file hellocgi.cgi (The web server may be configured to recognise CGI scripts only if they have the .cgi extension) Does your webserver support running CGI scripts? John P.S Please cc the mailing list when you reply. There may

RE: mystery

2001-06-14 Thread John Edwards
Is the path the the perl exe correct? Note, copy the list in on your mails. John -Original Message- From: Sally [mailto:[EMAIL PROTECTED]] Sent: 14 June 2001 11:00 To: John Edwards Subject: RE: mystery It has recognised .pl scripts in the past (i.e. last week), I do have access to the

RE: mystery

2001-06-14 Thread Sally
-Original Message- From: John Edwards [mailto:[EMAIL PROTECTED]] Sent: 14 June 2001 10:58 To: 'Sally'; Perl Beginners (E-mail) Subject: RE: mystery OK. Do you have access to the server logs? Have you tried naming the file hellocgi.cgi (The web server may be configured to recognise CGI

RE: mystery

2001-06-14 Thread Sally
Yeah it's right, it's the one I've got from our hosts -Original Message- From: John Edwards [mailto:[EMAIL PROTECTED]] Sent: 14 June 2001 11:04 To: 'Sally'; Perl Beginners (E-mail) Subject: RE: mystery Is the path the the perl exe correct? Note, copy the list in on your mails. John --

Re: php -> perl

2001-06-14 Thread Hasanuddin Tamir
On Wed, 13 Jun 2001, Michael Cartwright <[EMAIL PROTECTED]> wrote, > However, I need it in Perl. Could someone help me with what would this look > like in Perl? > > Thanks, > Michael > > $FileName=$HTTP_GET_VARS["FileName"]; > > if(!$FileName) > { > $FileName="example"; > } > $FileName.="

RE: mystery

2001-06-14 Thread John Edwards
OK. I think I see it now. Your script has errors in it. Try the following: --- Cut here --- #!/usr/bin/perl -wT use strict; #hellocgi print "Content-type: text/html\n\n"; print < Hello, world! Hello, world! HERE_DOC --- Cut here --- The web server is parsing the file as a perl s

RE: mystery

2001-06-14 Thread Sally
This is what I uploaded and it still didn't work #!/usr/bin/perl -wT use strict; #hellocgi print "Content-type: text/html\n\n"; print "<"; print""; print"Hello, world!"; print""; print""; print"Hello, world!"; print""; print""; print"HERE_DOC"; Thanks for the print ""; tip, I just wi

Reading Messages.tbb

2001-06-14 Thread Evgeny Goldin (aka Genie)
Hi, As I saw some of you are using "TheBat!" mail client, me too. I'd like to be able to read it's messages from the script - for that I have to know the binary format of "Messages.tbb" files where it keeps them. Those files are partially plain text, partially binary data. It's tempting

Lazy lists in Perl ?

2001-06-14 Thread Evgeny Goldin (aka Genie)
Hi, Is there any module implementing lazy lists ? ( similar to "infinite lists" of Scheme or "sequences" of ML ) I've coded a small prototype of this thing using tied array, so it's good time to stop or dig into further development .. Thank you !

RE: mystery

2001-06-14 Thread Richard_Cox
John Edwards [mailto:[EMAIL PROTECTED]] wrote: > > OK. I think I see it now. Your script has errors in it. Beat me to it... :-) but... > The web server is parsing the file as a perl script. You have > syntax errors > in your Perl script (All the HTML tags, for Perl to parse > them in the way

RE: mystery

2001-06-14 Thread Sally
Since using your suggestion, my list of errors has significantly reduced to: [Thu Jun 14 05:27:55 2001] [error] [client 213.123.194.47] Premature end of script headers: xyz./xyzxyz.../../cgihello.pl failed to open log file fopen: Permission denied

RE: mystery

2001-06-14 Thread John Edwards
No. Using the print < Hello, world! Hello, world! HERE_DOC --- Cut here --- -Original Message- From: Sally [mailto:[EMAIL PROTECTED]] Sent: 14 June 2001 11:32 To: John Edwards; Perl Beginners (E-mail) Subject: RE: mystery This is what I uploaded and it still didn't work #!/us

RE: mystery

2001-06-14 Thread John Edwards
Hmm not sure what that is. Others on the list may have a better idea. My suggestion is to learn about the CGI.pm module. If you are going to be doing a lot of web and cgi perl coding, this module is a must. You can find more details here. http://www.wiley.com/legacy/compbooks/stein/ I stongly

RE: mystery

2001-06-14 Thread Sally
Sorry guys still no luck, I'm gonna knock this one on the head, and abandon that tutorial. -Original Message- From: John Edwards [mailto:[EMAIL PROTECTED]] Sent: 14 June 2001 11:47 To: 'Sally'; Perl Beginners (E-mail) Subject: RE: mystery No. Using the print < Hello, world! Hello,

RE: mystery

2001-06-14 Thread Sally
Forgot to say "thanks for your time" -Original Message- From: Sally [mailto:[EMAIL PROTECTED]] Sent: 14 June 2001 11:58 To: John Edwards; Perl Beginners (E-mail) Subject: RE: mystery Sorry guys still no luck, I'm gonna knock this one on the head, and abandon that tutorial. -Origina

Re: Lazy lists in Perl ?

2001-06-14 Thread Jeff 'japhy' Pinyan
On Jun 14, Evgeny Goldin (aka Genie) said: >Is there any module implementing lazy lists ? ( similar to "infinite >lists" of Scheme or "sequences" of ML ) > >I've coded a small prototype of this thing using tied array, so >it's good time to stop or dig into further development .. It sounds like w

FW: Telnet

2001-06-14 Thread Sally
-Original Message- From: Sally [mailto:[EMAIL PROTECTED]] Sent: 14 June 2001 13:53 To: perlcgi Subject: Telnet I've seen lots of references to telnet, but I can't find an explanation of what it actually is. Is it similar to FTP?

Re: Telnet

2001-06-14 Thread n6tadam
Hi, Telnet, gives you the ability to access a remote machine across a network, however, I would advise against using telnet. Instead, I recommend using SSH (Secure SHell), which is much more secure. Regards, Thomas Adam - Original Message - From: Sally <[EMAIL PROTECTED]> To: perl <[EM

Re: Telnet

2001-06-14 Thread EDonnelly
Net Term is quite good. "n6tadam"

RE: Telnet

2001-06-14 Thread Sally
Thanks guys, that's exactly what I needed to know (the lack of technical terms was fab!!!) -Original Message- From: n6tadam [mailto:[EMAIL PROTECTED]] Sent: 14 June 2001 14:21 To: Sally; perl Subject: Re: Telnet Hi, Telnet, gives you the ability to access a remote machine across a netw

RE: Telnet

2001-06-14 Thread Doug Johnson
Telnet is a method used to communicate to another machine. You use telnet to access a terminal window on a remote machine. It is as if you were sitting at the console of that machine (character based). You cannot however transfer files through telnet. You would use ftp to do that with. It is some

Re: Problem printing a system value to a filehandle (windows)

2001-06-14 Thread Mark Folse
I started out doing the same thing on my NT box many moons ago, and found this more reliable and easier to manage: ($day,$month,$date,$time,$year)=split (/ /,localtime); --- Craig S Monroe <[EMAIL PROTECTED]> wrote: > I decided that I wanted to time stamp each of > the entries > > > $time =~ s

Re: Problem printing a system value to a filehandle (windows)

2001-06-14 Thread Brett W. McCoy
On Thu, 14 Jun 2001, Mark Folse wrote: > I started out doing the same thing on my NT box many moons ago, and > found this more reliable and easier to manage: > > ($day,$month,$date,$time,$year)=split (/ /,localtime); localtime can also be used directly in a list context, for more flexibility: m

RE: Problem printing a system value to a filehandle (windows)

2001-06-14 Thread JColwell
And add 1 to the month value. The months are returned 0 to 11 (Jan to Dec). Jeff Colwell Senior Software Engineer No electrons were harmed in making this e-mail message. -Original Message- From: Brett W. McCoy [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 14, 2001 9:12 AM To: Mark Fo

Re: map question

2001-06-14 Thread Paul
--- [EMAIL PROTECTED] wrote: > context". How do you evaluate a block in scalar context? Any light on > this ( or a pointer ) maybe? print { *STDOUT } "foo\n"; This is looking at the block to return the filehandle to which the output should go. Surely that argument is in a scalar context, sep

Re: Huge hash ... running out of memory without warning???

2001-06-14 Thread Paul
--- "Brett W. McCoy" <[EMAIL PROTECTED]> wrote: > On Wed, 13 Jun 2001, Bryan Gmyrek wrote: > > > I have just written a program that makes an array of hashes of > hashes of > > hashes. It reads all kind of information in from a bunch of files > and > > then later I access the elements of this th

Re: Huge hash ... running out of memory without warning???

2001-06-14 Thread Brett W. McCoy
On Thu, 14 Jun 2001, Paul wrote: > dbm's are *wonderful* for some data, but not for dynamically accessing > complex data structures. This only stores the top level, which *points* > to actual data further down the chain at the time of the program run. :o/ Right. In a later message, I suggested

Re: mystery

2001-06-14 Thread Paul
--- Sally <[EMAIL PROTECTED]> wrote: > I got the following code from a tutorial. Are you sure you got all of it? I see a lot of bare HTML, which should send the Perl parser into predictable spasms even *without* strict (but use strict!!!). > When I uploaded (FTP) it as a perl > file I got more

Please help me!

2001-06-14 Thread Euan
I have been trying to write a script . a mobile number is entered into a form which is sent to the script, The script removes the leading 0 then adds a +44 in front and tacks a @domain.com onto the end. Then it saves this new number/email to a txt file and automatically sends out an e-mail to

regex matching

2001-06-14 Thread Brian . T . Wallace
i have a basic knowledge of regex but i want to know if there is a simpler way to pull patterns out of a line. if i have a line like: here is a sample with 123.456.123.456 in the middle. m/\d\.\d\.\d\.\d/ will match the entire line. is there an easy way to get only the ip address? thanks

RE: Please help me!

2001-06-14 Thread John Edwards
Suggestions. Don't use a variable called $newvar, call it $form_input or $phone_number or somthing. Make it descriptive of the value it holds, either the source of the data or the expected content. It'll make life easier in the long run. Use a module to inferface with Sendmail. Let it do the har

RE: This is odd to me - Perl & XML resources

2001-06-14 Thread KURTZ
You shouldn't feel too bad - my company sent me to Perl training and my instructor (okay, he was a sub) couldn't give me a good definition of regular expressions! I think the reason why you see so many different types of discussions here is that many of us probably work as developers in other lan

avoiding duplicates

2001-06-14 Thread David Gilden
Greetings, a couple of questions here, --- # Text colors @colors = qw[ #F0F8FF #00 #7FFFD4 #F0 #F5F5DC #FFE4C4 #00 #FF #8A2BE2 #A52A2A #5F9EA0 #7FFF00 #FF7F50 #DC143C #00 #8B #008B8B #B8860B #FA8072 #F4A460 #2E8B57 #A0522D #6A5ACD #00FF7F #4682B4 #D2B48C #008080

Re: regex matching

2001-06-14 Thread Paul
--- [EMAIL PROTECTED] wrote: > i have a basic knowledge of regex but i want to know if there is a > simpler way to pull patterns out of a line. > > if i have a line like: > > here is a sample with 123.456.123.456 in the middle. > > m/\d\.\d\.\d\.\d/ will match the entire line. is there a

Slicing and dicing

2001-06-14 Thread David Gilden
Is one style better then the other here? Thanks, Dave - sub print_table_rows { my $name = shift; my $key = shift; my $date = shift; print < $thread{$key} $name$date data --- alt sub print_table_rows { my ($name,$key,$date) = @_[0..2] print < $thread{$key} $name$date data

Re: Slicing and dicing

2001-06-14 Thread Jeff 'japhy' Pinyan
On Jun 14, David Gilden said: >my ($name,$key,$date) = @_[0..2] You needn't even use an explicit slice. my ($name, $key, $date) = @_; works fine here, and is generally preferred over large amounts of shift()s. If you do need to be destructive to @_, then you might want to splice() it, inste

RE: regex matching

2001-06-14 Thread John Edwards
This will give you the IP only if valid. I've attached as a file too in case the code gets mangled. --- $string = "here is a sample with 123.456.123.456 in the middle."; if ($string =~ /([01]?\d\d|2[0-4]\d|25[0-5])\.([01]?\d\d|2[0-4]\d|25[0-5])\.([01]?\d\d|2[0- 4]\d|25[0-5])\.([01]?\d\d|2[0-4]

RE: use of split command - concession

2001-06-14 Thread Dave Newton
> OK, I had to try the two ways again to see how much difference it made. I > created a random contents fixed field file 14500 lines long X 80 columns > wide, and tried processing the lines (using substr($_,)to > break lines up into 4 sections, substitute based on a few patterns, and change a

Re: avoiding duplicates

2001-06-14 Thread Jeff 'japhy' Pinyan
On Jun 14, David Gilden said: >sub choseColor{ >return int (rand ($#colors + 1)); >} > ># $#colors + 1 --> better written as int (rand @colors); ># is this ok, using an @array as in a loop to ># like: while ($i < @array) {... do something...; $i++} Yes, it's fine. An array in SCALAR CONTEXT

Re: regex matching

2001-06-14 Thread Ken
\d only matches one digithere's a way to extract each number from an ip: use strict; my( $ip ); print "Enter a string with an IP:"; $ip = ; $ip =~ m/(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; print "$1\n"; print "$2\n"; print "$3\n"; print "$4\n"; Or if you just want the ip from the line: u

RE: A Term::ReadKey question -- keep cursor put!

2001-06-14 Thread Dave Newton
> He'd never seen the spinny cursor and was quite impressed - quite sad really! *grin* I'll admit they're cute :) Great story though; I'll have to remember that as an easy way to impress people. Dave

RE: regex matching

2001-06-14 Thread John Edwards
"To just make sure what you have is an ip (and only an ip) is: m/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/;" Not true. An IP can only consist of numbers ranging from 0 to 255. Your example will match an 'IP' that looks like this; 311.497.999.587 for instance. The example I gave isn't perfect (and

Re: regex matching

2001-06-14 Thread Ken
Doesn't {1,3} mean minimum of 1 and maximum of 3 of whatever character comes before the {}'s? I ran this code with the following ip: 192.168.0.34 It works fine. - Original Message - From: "John Edwards" <[EMAIL PROTECTED]> To: "'Ken'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>; <[EMAIL PRO

RE: regex matching

2001-06-14 Thread Jason C. Lamb
Ken, Your code will match any valid ip address, plus a bunch of addresses that are not valid, Try it with: 111.222.333.444 But I think that keeping in Brian's original question, it doesn't matter. He is probably parsing the output of some program that is giving him a valid ip, so you code will w

Re: Slicing and dicing

2001-06-14 Thread Paul
--- David Gilden <[EMAIL PROTECTED]> wrote: > Is one style better then the other here? > > sub print_table_rows { > my $name = shift; > my $key = shift; > my $date = shift; > --- alt > sub print_table_rows { > my ($name,$key,$date) = @_[0..2] I'd just say my ($name,$key,$date) = @_;

RE: regex matching

2001-06-14 Thread John Edwards
Well it would. Run it with an 'IP' of 123.456.789.0. Still matches, right? But that's not a valid IP. It's a valid number if your looking for four groups of numbers, each no more than 3 digits in length, seperated by a . (which is what your code does). But it's not a test for a valid IP address.

Re: Lazy lists in Perl ?

2001-06-14 Thread Peter Scott
At 01:32 PM 6/14/01 +0200, Evgeny Goldin (aka Genie) wrote: > Hi, > >Is there any module implementing lazy lists ? ( similar to "infinite >lists" of Scheme or "sequences" of ML ) In addition to ways of doing it in Perl 5, this has been mooted as a native capability for Perl 6: http://dev.perl

Re: regex matching

2001-06-14 Thread Ken
Ok, strike my previous comments. My apologies for wasting your time. - Original Message - From: "Ken" <[EMAIL PROTECTED]> To: "John Edwards" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Thursday, June 14, 2001 9:45 AM Subject: Re: regex matching > Doesn't {1,3} mean minimum of 1 and

Help with File Exists

2001-06-14 Thread Maynard, Garth
I am iterating through a long hash list, and I want to be able to pause the script. To do this, I have put a while (-!e $go) loop inside of the while (keys (%hash)) loop, but the script is looking for $go within %hash, rather than the predefined location. The error I am getting is: "Can't call me

Re: Noobie question

2001-06-14 Thread Michael D . Risser
On Thursday 14 June 2001 08:04 am, you wrote: > OK I give up > > TMTOWTDI? > There's More Than One Way To Do It

RE: Help with File Exists

2001-06-14 Thread John Edwards
try !-e instead of -!e. You need to negate the result of the -e operator. By putting a ! in the middle of the -e operator, perl no longer knows what it is. -Original Message- From: Maynard, Garth [mailto:[EMAIL PROTECTED]] Sent: 14 June 2001 17:05 To: [EMAIL PROTECTED] Subject: Help with

Perl UNIX commands

2001-06-14 Thread John Joseph Roets
I found a site a while back which detailed a pursuit to develop Perl commands to replace universal UNIX commands. Thus, providing advanced benefits/features, such as more full regex matching abilities, etc. My problem: I cannot now find this site. I can't even remember how I came across it. Might

Re: Perl UNIX commands

2001-06-14 Thread iain truskett
* John Joseph Roets ([EMAIL PROTECTED]) [14 Jun 2001 16:34]: > I found a site a while back which detailed a pursuit to develop Perl > commands to replace universal UNIX commands. Thus, providing advanced > benefits/features, such as more full regex matching abilities, etc. > My problem: > I cann

Re: Help needed with setting up a SMTP connection

2001-06-14 Thread Me
> So it would appear that the Cookbook has got a typo. Sorta. You might want to read in the deja thread I referred you to. [A thread from 1999. And I didn't find a correction in the Cookbook's errata (though that could be because the searching process is tedious and I wasn't motivated to keep at

Where to begin??!!??

2001-06-14 Thread Crystal Gruetzmacher
Hi all, I have a problem and I need to know where to begin. At the magazine I work for we have what are called "bingo cards" in the magazine that people can fill out and send back to us to get information on whatever of 271 topics, stores, resorts, etc. of their choice. They can also fill this ou

Re: Where to begin??!!??

2001-06-14 Thread Morbus Iff
>The point: >I need to take this text file and format each entry (separated by hard >returns) so that the user info (name address, etc) are all in their own >columns still and then for each number they chose (up to 271 out of 271) it >creates a new entry with their contact info and one number

Weekly list FAQ posting

2001-06-14 Thread casey
NAME beginners-faq - FAQ for the beginners mailing list 1 - Administriva 1.1 - I'm not subscribed - how do I subscribe? Send mail to <[EMAIL PROTECTED]> You can also specify your subscription email address by sending email to (assuming [EMAIL PROTECTED] is your email address)

Re: Help needed with setting up a SMTP connection

2001-06-14 Thread Michael Fowler
On Thu, Jun 14, 2001 at 11:25:51AM +0200, Adrienne Kotze wrote: > Michael Fowler wrote: > > > > On Thu, Jun 14, 2001 at 08:30:14AM +0200, Adrienne Kotze wrote: > > > $mailer = Mail::Mailer->new ("smtp", "smtp.mydomain.com") ; > > > > This should be: > > > > $mailer = Mail::Mailer->new("smtp

Collapsing Duplicates

2001-06-14 Thread E. Alan Hogue
Hello, I'm trying to write a script that takes a list of company names, their corresponding URLS, and their office locations, makes the names into html links, and puts it all into a web page. The problem is that the list I'm working from sometimes has two entries for the same company. The name a

nested checks

2001-06-14 Thread charles
i am running through a series of if/elsif checks on a variable: if (($add_alias) && ($add_destination) && (!$selection)) { if ( $add_alias =~ /[^\w\.\-]/ ) { } elsif ( $add_destination !~ /\@/ ) { } else { open(FILE, ">>$filename"); print FILE "$add_alias\@$domain\t$add_

Re: stdout/stderr

2001-06-14 Thread Evgeny Goldin (aka Genie)
> I had another idea, but that is revert back to stupidity ;) > using system and sending the output to a file then open the file ;) Why not ? That's just fine

Re: regex matching

2001-06-14 Thread Evgeny Goldin (aka Genie)
> /(\d\d?\d?\.\d\d?\d?\.\d\d?\d?\.\d\d?\d?)/; > /([01]?\d\d|2[0-4]\d|25[0-5])\.([01]?\d\d|2[0-4]\d|25[0-5])\.([01]?\d\d|2[0- > 4]\d|25[0-5])\.([01]?\d\d|2[0-4]\d|25[0-5])/) Wou ! Looks like too many symbols .. Does matching a legal IP worth a regex 1km long ? I think it's better to match the IP

Re: Collapsing Duplicates

2001-06-14 Thread Me
> I'm having a very hard time figuring this out. Does > anyone have any suggestions or pointers for the best > way to go about this? Go buy the Perl Cookbook. A truly superb book that gives highly distilled, highly productive answers to hundreds of standard things you will want to do like this in

Sort hash by values

2001-06-14 Thread David Gilden
Hello, Stuck here, The first sort block works like a charm! if ($sort_order == 1) { # sort by name # $key is really the filename with out the path and '.html' foreach my $key (sort {lc($a) cmp lc($b)} keys %subjects){ my $name; ($name = $key ) =~ s/_(\d+)$//; $name =~ tr/_/ /

Re: Perl UNIX commands

2001-06-14 Thread Peter Scott
At 11:33 AM 6/14/01 -0500, John Joseph Roets wrote: >I found a site a while back which detailed a pursuit to develop Perl >commands to replace universal UNIX commands. >Thus, providing advanced benefits/features, such as more full regex matching >abilities, etc. >My problem: >I cannot now find thi

Re: regex matching

2001-06-14 Thread Peter Scott
At 09:59 PM 6/14/01 +0200, Evgeny Goldin (aka Genie) wrote: > > /(\d\d?\d?\.\d\d?\d?\.\d\d?\d?\.\d\d?\d?)/; > > > > /([01]?\d\d|2[0-4]\d|25[0-5])\.([01]?\d\d|2[0-4]\d|25[0-5])\.([01]?\d\d|2[0- > > 4]\d|25[0-5])\.([01]?\d\d|2[0-4]\d|25[0-5])/) > >Wou ! Looks like too many symbols .. Does matching

RE: regex matching

2001-06-14 Thread Jason C. Lamb
I got this out of the Komodo help file: IP addresses are difficult to match using a simple regular expression, because the regular expression must verify that the IP address against which it is matching is valid. A simple expression such as /\d{3}\.\d{3}\.\d{3}\.\d{3}/ will incorrectly match str

RE: Sort hash by values

2001-06-14 Thread Wagner-David
Use of keys, map and sort (untested) foreach my $subject (sort {lc($a) cmp lc($b)} map {[ $_, $subjects{$_}]} keys %subjects){ printf "%-40s: %-s\n", $subjects{$subject->[0]}, $subject->[0]; } Wags ;) -Original Message- From: David Gilden [mailto:[EMAIL PROTECTED]] Sent: Thursday, J

RE: Sort hash by values

2001-06-14 Thread Wagner-David
Sorry, but as soon as I saw the input coming back I knew it was really untested. Should be sort {lc($a->[1]) cmp lc($b->[1])} and NOT sort {lc($a) cmp lc($b)} Wags ;) -Original Message- From: Wagner-David Sent: Thursday, June 14, 2001 13:21 To: 'David Gilden'; [EMAIL PROTECTED] Subject

PARSING A FILE

2001-06-14 Thread Pedro A Reche Gallardo
Hi to everyone, I have a file that it looks like this >name1 line 1 line 2 >name2 line a line b and I want it to look this way name1 line1.line2 name2 linea.lineb Anyone help welcomed Greetings, Pedro -- **

counting regex matches

2001-06-14 Thread Bob Mangold
Is there a simple way to know how many times a regex matches. Say for example: $string =~ /a/g; # match on all 'a' in $string Now how do I know how many times it actually matched? -Bob __ Do You Yahoo!? Get personalized email addresses from Yahoo

Re[2]: regex matching

2001-06-14 Thread Evgeny Goldin (aka Genie)
PS> It's simply a matter of how pedantic you wish to be. The example you PS> pasted is not a valid IP address (maximum component value is 255). You didn't read my words carefully, it was "I think it's better to match the IP first, split /\./ it to four digits and check if their combination is l

Re: counting regex matches

2001-06-14 Thread Carl Rogers
> >$string =~ /a/g; # match on all 'a' in $string > >Now how do I know how many times it actually matched? Try: $result = $string =~ /a/g; The value will be in $result Carl

RE: PARSING A FILE

2001-06-14 Thread Wagner-David
Major assumptions: format you stated (ie name, line 1, line 2) No checking at this point, other than the first read should be > . Also assumed from your input that you wanted ALL white space removed. Untested, but a starting point. Also assumed you will setup the open for input and output accor

RE: counting regex matches

2001-06-14 Thread Wagner-David
I only get a one when doing it that way. I had to do the following: my $string = 'abcadebavdacde'; my $MyCount = 0; while ( $string =~ /a/g ) { $MyCount++}; printf "String:\n%-s\nCount: %4d\n", $string, $MyCount; Output: String: abcadebavdacde Count:4 Wags ;) -Original Message-

Re: PARSING A FILE

2001-06-14 Thread Chas Owens
The following code does no checking to insure the format is correct. This is left as an excerise for the reader. #!/usr/bin/perl -w use strict; #make me behave my $first = 1; my $line; while (<>) { #read lines from stdin or files listed #on cmd lin

Re: counting regex matches

2001-06-14 Thread Sean O'Leary
At 05:08 PM 6/14/2001, you wrote: >Try: >$result = $string =~ /a/g; >The value will be in $result > >Carl Close. You have to force list context for the result of the pattern match to make it work. Like this: $result = () = $string =~ /a/g; (Thanks to Mark-Jason Dominus) Check out perlop for

Re: counting regex matches

2001-06-14 Thread Sean O'Leary
Oops! Sorry! Wrong section of the documentation. I meant to grab the paragraph a little further down. Still in perlop, still in the Regexp Quote-Like Operators section: The /g modifier specifies global pattern matching--that is, matching as many times as possible within the string. How i

Question about submit buttons

2001-06-14 Thread Ward, Stefan
Below I want to take the value they select form a list and place it into the where clause of the SQL statement. How do I get there from here? I know I need a submit button, where does that go in the structure of the print $query??? if ($guess eq "") { print header; print $que

major "I have no clue" here

2001-06-14 Thread Ronald J. Yacketta
I have been tasked to parse ~1500 log files summing a total of ~100mb cleanly, effectively and with little impact on the system. The current process uses a korn shell and greps ALL ~1500 files or certain patterns and sends the output to another file were later in the script it is greped again! WO

Can't understand Reference interpretation

2001-06-14 Thread Atul_Khot
Gurus, The Camel, ( 3rd Ed. ), says, - $listref->[2][2] = "hello";# pretty clear $$listref[2][2] = "hello"; # A bit confusing This second of these statements may disconcert the C p

Re: nested checks

2001-06-14 Thread Michael Fowler
On Thu, Jun 14, 2001 at 01:51:29PM -0500, [EMAIL PROTECTED] wrote: > i am running through a series of if/elsif checks on a variable: > > if (($add_alias) && ($add_destination) && (!$selection)) { > >if ( $add_alias =~ /[^\w\.\-]/ ) { > >} elsif ( $add_destination !~ /\@/ ) { > >} e

Re: counting regex matches

2001-06-14 Thread Michael Fowler
On Thu, Jun 14, 2001 at 05:08:30PM -0400, Carl Rogers wrote: > > > > >$string =~ /a/g; # match on all 'a' in $string > > > >Now how do I know how many times it actually matched? > > Try: > $result = $string =~ /a/g; > The value will be in $result > perl -wle '$str = "abcabcabc"; $cnt = $str

Re: Can't understand Reference interpretation

2001-06-14 Thread Peter Scott
At 06:04 PM 6/14/01 -0500, [EMAIL PROTECTED] wrote: >Gurus, Grasshopper, > The Camel, ( 3rd Ed. ), says, >- >$listref->[2][2] = "hello";# pretty clear >$$listref[2][2] = "hello"; #

Re: major "I have no clue" here

2001-06-14 Thread Me
> I have been tasked to parse ~1500 log files summing a total of ~100mb > cleanly, effectively and with little impact on the system. I'd use http://www.analog.cx unless you really have to use perl. It would do the whole lot in a few seconds.

Re: major "I have no clue" here

2001-06-14 Thread Me
> [analog] looks nice, but I am not sure it is suited for my needs > [because the logs I'm parsing aren't web logs] Sorry, my brain must have slipped out of gear while I wasn't looking. Forget analog. The file count doesn't seem that much. I suggest you use opendir and cousins to process files

Net::Telnet

2001-06-14 Thread Kris G Findlay
i have written this script .. just supposed to log into computer on network and start a forwarded gnome session to my Nt machine ! problem is i cant get the prompt to match. #perl script #!e:\perl\bin\perl use Net::Telnet; $telnet = Net::Telnet->new

Re: Net::Telnet

2001-06-14 Thread Paul Dean
Hya, At 03:56 AM 15/06/2001 +0100, Kris G Findlay wrote: >i have written this script .. just supposed to log into computer on network >and start a forwarded gnome session to my Nt machine ! > >problem is i cant get the prompt to match. > >#perl script > > #!e:\perl\b

Credit Protocol

2001-06-14 Thread Teresa Raymond
What is the credit protocol if I only want to use one piece (to me a significant piece) of someone's free program? Where do I display the credit in the top of the cgi script or where the piece of code that I used is, and also in the html page accessing the script? *** Teresa Raymond *** htt

Re: nested checks

2001-06-14 Thread charles
> If this is really what your code looks like, with unused blocks and all, > it's better written as: > > if ( $add_alias && $add_destination && !$selection > && $add_alias !~ /[^\w\.\-]/] > && $add_destination !~ /\@/ > ) { > # ... code goes here ... > }

Re: nested checks

2001-06-14 Thread Michael Fowler
On Thu, Jun 14, 2001 at 11:10:43PM -0500, [EMAIL PROTECTED] wrote: > > Format to taste, of course. Your checks on $add_alias, $add_destination, > > and $selection should also probably be checks for defined'ness, not truth. > > 0 is false, but, according to your definition of what $add_alias shoul

  1   2   >