Re: SubRoutine Help

2002-01-07 Thread John W. Krahn

"Michael R. Wolf" wrote:
> 
> # Readable.
> sub total {
> my $sum;
> foreach my $num (@_) {
> $sum += $num;
> }
> return $sum;
> }
> 
> # Streamlined
> sub total {
> my $sum;
> $sum += $_ foreach (@_);# $_ implicitly set
> }   # sum implicitly returned
^^^

$ perl -le'
@fred = qw(1 3 5 7 9);
sub total {
my $sum;
$sum += $_ foreach (@_);
}
print total( @fred );
'

$ perl -le'
@fred = qw(1 3 5 7 9);
sub total {
my $sum;
$sum += $_ foreach (@_);
$sum;
}
print total( @fred );
'
25



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Adding quotes to a string variable

2002-01-07 Thread Hubert Ian M. Tabug

Hello,
   I have a variable say $a = "Test Test Test" whose contents when printed out is 
Test Test Test. I want the said variable to have the quotes appended, meaning
 it will print out "Test Test Test" and the variable will contain the quotes as well. 
Is that possible? You help would be greatly appreciated.


Thanks




RE: Adding quotes to a string variable

2002-01-07 Thread Robert Graham

You have two options:

Option one: Put the string between single quotes $a = '"Test Test Test"';

Option two:  $a = q("Test Test Test");

Regards
Robert Graham

-Original Message-
From: Hubert Ian M. Tabug [mailto:[EMAIL PROTECTED]]
Sent: 07 January 2002 12:02
To: Perl
Subject: Adding quotes to a string variable


Hello,
   I have a variable say $a = "Test Test Test" whose contents when
printed out is Test Test Test. I want the said variable to have the quotes
appended, meaning
 it will print out "Test Test Test" and the variable will contain the quotes
as well. Is that possible? You help would be greatly appreciated.


Thanks



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Adding quotes to a string variable

2002-01-07 Thread Steven Brooks

On Monday 07 January 2002 03:16 am, you wrote:
> You have two options:
>
> Option one: Put the string between single quotes $a = '"Test Test Test"';
>
> Option two:  $a = q("Test Test Test");
>
> Regards
> Robert Graham

Well, there are other options.  Not that they are better, but they are
options.  Both require escaping the characters.

$a = "\"Test Test Test\"";
$a = qq{"\"Test Test Test\""};


Steven

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Query

2002-01-07 Thread Jon Molin

Manish Uskaikar wrote:
> 
> Can anyone tell me if i can use threads in perl; If yes then what all library files 
>i have to include. Also tell me how i include a system library file like "math.h" or 
>"unistd.h" in perl. How can one include "C" libraries in perl program i.e.. *.pl
> 
> Regards
> 
> Manish U.


You'll need some reading, check out

http://search.cpan.org/search?mode=module&query=thread

and
http://learn.perl.org/


also, please cut the lines at 72-78!

/Jon

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: regexp to replace double with single quotes inside html tags

2002-01-07 Thread birgit kellner

--On Sonntag, 06. Jänner 2002 22:48 -0500 "Michael R. Wolf" 
<[EMAIL PROTECTED]> wrote:


>
>
> Which is why many folks use a parser rather than regular
> expressions for this.  The parsers take care of the special
> cases that are very, very, very (read the history of this
> group) difficult to get around with RE's.  Trying to do a
> full-blown RE to get all the special cases would be like
> trying to herd cats.  Don't try it but for the very simple
> cases.
>

I know, but the problem is that HTML::Parser only works with *files*. You 
have to pass a filename to it.
I want to perform this routine on hash values inside a perl script, without 
having to write them to a file.
Do you know of any parser that works without files?


Birgit Kellner

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: RegEx speed (was: Using regexp to get a substring)

2002-01-07 Thread Jos I. Boumans

if we're talking about optimization and the question was really how to
CAPTURE the characters after the last /
there is really NO need for a s/// and a simple m// would do
which i imagine will also be  quite a bit faster

regards,
jos

- Original Message -
From: "Gary Hawkins" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; "David" <[EMAIL PROTECTED]>
Sent: Sunday, January 06, 2002 11:48 PM
Subject: RegEx speed (was: Using regexp to get a substring)


> That'll work, but on a finer point, if you need to be thinking about
> optimization at the moment:
>
> ($substring1 = $string) =~ s/.*\\(.*)/$1/;
>
> is about 4 times slower than:
>
> ($substring2 = $string) =~ s/.*\\//;
>
> because the second one doesn't have to store the matched value inside
the
> parens in $1.
>
> In test below:
> substring1 code took:  20 wallclock secs (20.05 usr +  0.00 sys = 20.05
CPU)
> substring2 code took:   5 wallclock secs ( 5.15 usr +  0.00 sys =  5.15
CPU)
>
> So it can be best to use $1 thru $9 only when necessary if speed matters.
>
> Gary
>
> ==
>
> Notes:
>
> In this test script we do the substitution a million times for each method
and
> then print the benchmark results.  You can tailor this script to check the
> comparison on any two or more different ways of doing something.
>
> #!perl.exe
>
> use Benchmark;
>
> $string ='C:\PerlScripts\TestSamples\StringTest.pl';
>
> # substring1 method
> $i = 0;
> $t0 = new Benchmark;
> while ($i < 100) {
> ($substring1 = $string) =~ s/.*\\(.*)/$1/;
> $i++;
> }
> $t1 = new Benchmark;
> $td = timediff($t1, $t0);
> print "substring1 code took:  ", timestr($td), "\n\n";
>
> # substring2 method
> $i = 0;
> $t0 = new Benchmark;
> while ($i < 100) {
> ($substring2 = $string) =~ s/.*\\//;
> $i++;
> }
> $t1 = new Benchmark;
> $td = timediff($t1, $t0);
> print "substring2 code took:  ", timestr($td), "\n\n";
>
> __END__
>
> Printed result:
>
> substring1 code took:  20 wallclock secs (20.05 usr +  0.00 sys = 20.05
CPU)
>
> substring2 code took:   5 wallclock secs ( 5.15 usr +  0.00 sys =  5.15
CPU)
>
>
> > -Original Message-
> > From: Shawn [mailto:[EMAIL PROTECTED]]
> > Sent: Sunday, January 06, 2002 1:03 PM
> > To: [EMAIL PROTECTED]; David
> > Subject: Re: Using regexp to get a substring
> >
> >
> > "David" <[EMAIL PROTECTED]> wrote in message
> > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > Hello All,
> > >
> > > I am beginner and need some helps. Thanks a lot!
> > >
> > > The question is, if I have a string, for example
> > > "C:\PerlScripts\TestSamples\StringTest.pl", how do I use regexp to
parse
> > > this string and get substring after the last backslash
("StringTest.pl").
> >
> > Hey David,
> >   This should work for you:
> >
> > use strict;
> > my $String='C:\PerlScripts\TestSamples\StringTest.pl';
> > (my $substring =$string) =~s/.*\\(.*)/$1/;
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Adding quotes to a string variable

2002-01-07 Thread John

$a = "\"TEST TEST TEST\"";
print "$a";

Prints: "TEST TEST TEST"
The quotes are part of the string stored in the variable

-Original Message-
From: Hubert Ian M. Tabug [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 07, 2002 3:02 AM
To: Perl
Subject: Adding quotes to a string variable


Hello,
   I have a variable say $a = "Test Test Test" whose contents when
printed out is Test Test Test. I want the said variable to have the quotes
appended, meaning
 it will print out "Test Test Test" and the variable will contain the quotes
as well. Is that possible? You help would be greatly appreciated.


Thanks



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Adding quotes to a string variable

2002-01-07 Thread John W. Krahn

Steven Brooks wrote:
> 
> On Monday 07 January 2002 03:16 am, you wrote:
> > You have two options:
> >
> > Option one: Put the string between single quotes $a = '"Test Test Test"';
> >
> > Option two:  $a = q("Test Test Test");
> >
> > Regards
> > Robert Graham
> 
> Well, there are other options.  Not that they are better, but they are
> options.  Both require escaping the characters.
> 
> $a = "\"Test Test Test\"";
> $a = qq{"\"Test Test Test\""};
   ^   ^
Back-slashes are not required when using qq().  Your example would print
""Test Test Test"" with two quotes on either side.  So, to sum up, the
options are:

$a =  "\"Test Test Test\"";
$a =   '"Test Test Test"';
$a = qq/"Test Test Test"/;
$a =  q/"Test Test Test"/;


John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: regexp to replace double with single quotes inside html tags

2002-01-07 Thread John W. Krahn

Birgit Kellner wrote:
> 
> --On Sonntag, 06. Jänner 2002 22:48 -0500 "Michael R. Wolf"
> <[EMAIL PROTECTED]> wrote:
> >
> > Which is why many folks use a parser rather than regular
> > expressions for this.  The parsers take care of the special
> > cases that are very, very, very (read the history of this
> > group) difficult to get around with RE's.  Trying to do a
> > full-blown RE to get all the special cases would be like
> > trying to herd cats.  Don't try it but for the very simple
> > cases.
> 
> I know, but the problem is that HTML::Parser only works with *files*. You
> have to pass a filename to it.

Actually, no you don't:

=item $p->parse( $string )

Parse $string as the next chunk of the HTML document.  The return
value is normally a reference to the parser object (i.e. $p).
Handlers invoked should not attempt modify the $string in-place until
$p->parse returns.

If an invoked event handler aborts parsing by calling $p->eof, then
$p->parse() will return a FALSE value.



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Adobe modules - append/'merge' pdf files

2002-01-07 Thread McCollum, Frank

I would like to move some VB6 modules that 'merge' adobe pdf files together,
into Perl. I cannot find anything on this.  Does anyone have any experience
with this?

To everyone who helped me out over the weekend when I thought I destroyed my
laptop with the linux install (Especially the little tidbit about winnt.exe
in the i386 folder for W2k), both platforms seem to be ready to go now.
I really appreciate it.  

Thanks,

Frank McCollum
Bank Of America Securities, LLC
[EMAIL PROTECTED]
(704) 388-8894

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




your my last hope on this cgi programming question

2002-01-07 Thread Hockey List

I posted this in a perl forum and was told you all
might be able to help..

I was hoping you might point me in the right direction
on a pretty simple problem. I have spent days just
trying to see HOW to get this done, let alone doing
it. This seems so damn simply but Im running into a
brick wall.

I dabble in Visual Basic, but I am by no means a
'programmer'. Im a hockey player and  I have built a
website for some friends of mine and I would like to
be able to update some stats.

If you have a moment, Please take a look at
http://www.goaliebrotherhood.com and go to the members
stats page. You see my friends and myslelf listed,
along with our stats.

Here is my question: How hard would it be to provide
some input window so that this each of us could update
our stats? Like I said, I dabble in VB and is seems
pretty simple. But I dont know anything about CGI or
Pearl... I am willing to learn, like I said, this
doesnt sound like a mammoth udertaking to me. Its
pretty simple.

GP = Games played.. just goes up by 1 each update. W +
L + T = GP
W/L/T = Win, Loss, Or Tie... Probably a radio button
and then each value goes up by one, depending on which
button is selected.
GA = Goals Allowed(not seen).. Total goals allowed in
all games. the goals you let in.. Input box adds to
the total each update.
GAA = Goals Against Average.Total Goals Against
divided by games played.

Obviously, there would have to be some way to input
which user you, are, a password enter field and a
button to clear the stats at the start of a new
season... Possibly a way to change your password, then
I would need a way to add a new user.. I actually did
get that part built. Check out the site. Pretty
simple, right... WRONG

First, I started looking for something remotely hosted
that I could just hook up. It doesnt exist. while its
really simple. its pretty specific to a small niche of
people (hockey goalies) and I cant find anything that
will do it. So I started learning cgi. how hard can it
be to make something this simple? well, I started to
get the jist of cgi and found out that my website host
(freeservers.com) wont let me into the cgi-bin.. so
now I not only need to learn cgi and program the damn
thing.. but I need to find a place that will give me a
bin, if that exists.

Anyway. Thats my dilemma, If you know a good site that
can teach me how to do this, I would really appreciate
hearing about it. funny thing is, even after all this
headache.. I still think this will be better than
updating by hand, like I have been doing..

Thanks in advance.

-Michael #39
http://www.goaliebrotherhood.com
[EMAIL PROTECTED]








=
The Goalie Brotherhood:
http://www.goaliebrotherhood.com

__
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




@$

2002-01-07 Thread McCollum, Frank

What does the "@$" sign indicate?  I have a value in @$row in the code below
that I want to strip out any html tags.  I tried to use "s/\<*\>//g;" but it
gives me an error ("Can't modify array deref in substitution").


 foreach $ts ($te->table_states) {
   print "Table (", join(',', $ts->coords), "):\n";
   foreach $row ($ts->rows) {
print @$row;

  print join(',', @$row), "\n";
   }
 }


Thanks,
Frank McCollum
Bank Of America Securities, LLC
[EMAIL PROTECTED]
(704) 388-8894

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




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 form, then
when that form is submitted, store the results. For some pointers, take a
look at this site.

http://www.devdaily.com/Dir/Perl/Articles_and_Tutorials/CGI/

HTH

John

-Original Message-
From: Hockey List [mailto:[EMAIL PROTECTED]]
Sent: 07 January 2002 15:03
To: [EMAIL PROTECTED]
Subject: your my last hope on this cgi programming question


I posted this in a perl forum and was told you all
might be able to help..

I was hoping you might point me in the right direction
on a pretty simple problem. I have spent days just
trying to see HOW to get this done, let alone doing
it. This seems so damn simply but Im running into a
brick wall.

I dabble in Visual Basic, but I am by no means a
'programmer'. Im a hockey player and  I have built a
website for some friends of mine and I would like to
be able to update some stats.

If you have a moment, Please take a look at
http://www.goaliebrotherhood.com and go to the members
stats page. You see my friends and myslelf listed,
along with our stats.

Here is my question: How hard would it be to provide
some input window so that this each of us could update
our stats? Like I said, I dabble in VB and is seems
pretty simple. But I dont know anything about CGI or
Pearl... I am willing to learn, like I said, this
doesnt sound like a mammoth udertaking to me. Its
pretty simple.

GP = Games played.. just goes up by 1 each update. W +
L + T = GP
W/L/T = Win, Loss, Or Tie... Probably a radio button
and then each value goes up by one, depending on which
button is selected.
GA = Goals Allowed(not seen).. Total goals allowed in
all games. the goals you let in.. Input box adds to
the total each update.
GAA = Goals Against Average.Total Goals Against
divided by games played.

Obviously, there would have to be some way to input
which user you, are, a password enter field and a
button to clear the stats at the start of a new
season... Possibly a way to change your password, then
I would need a way to add a new user.. I actually did
get that part built. Check out the site. Pretty
simple, right... WRONG

First, I started looking for something remotely hosted
that I could just hook up. It doesnt exist. while its
really simple. its pretty specific to a small niche of
people (hockey goalies) and I cant find anything that
will do it. So I started learning cgi. how hard can it
be to make something this simple? well, I started to
get the jist of cgi and found out that my website host
(freeservers.com) wont let me into the cgi-bin.. so
now I not only need to learn cgi and program the damn
thing.. but I need to find a place that will give me a
bin, if that exists.

Anyway. Thats my dilemma, If you know a good site that
can teach me how to do this, I would really appreciate
hearing about it. funny thing is, even after all this
headache.. I still think this will be better than
updating by hand, like I have been doing..

Thanks in advance.

-Michael #39
http://www.goaliebrotherhood.com
[EMAIL PROTECTED]








=
The Goalie Brotherhood:
http://www.goaliebrotherhood.com

__
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




EXCEL automation

2002-01-07 Thread Billie

Hi all,

What's wrong  with the following code?

use Win32::OLE;
$book = Win32::OLE->GetObject("Book1.xls");
$book->Saveas("Book2.xls");

Book1 and the script are in the same directory.  When I open Book2.xls, I
cannot see any worksheet. Why?

Thanks
Billie




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




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) {
my @row = @$row;

print @row;

  print join(',', @row), "\n";
   }
 }

You can now work on @row within the foreach instead of the dereferenced
@$row.

-Original Message-
From: McCollum, Frank [mailto:[EMAIL PROTECTED]]
Sent: 07 January 2002 15:08
To: [EMAIL PROTECTED]
Subject: @$


What does the "@$" sign indicate?  I have a value in @$row in the code below
that I want to strip out any html tags.  I tried to use "s/\<*\>//g;" but it
gives me an error ("Can't modify array deref in substitution").


 foreach $ts ($te->table_states) {
   print "Table (", join(',', $ts->coords), "):\n";
   foreach $row ($ts->rows) {
print @$row;

  print join(',', @$row), "\n";
   }
 }


Thanks,
Frank McCollum
Bank Of America Securities, LLC
[EMAIL PROTECTED]
(704) 388-8894

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: your my last hope on this cgi programming question

2002-01-07 Thread Hockey List

thats pretty much the main part of the problem.

Like I said, Im not afrain of the cgi. Its the fact
that the server wont allow me access 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
> 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 form, then
> when that form is submitted, store the results. For
> some pointers, take a
> look at this site.
> 
>
http://www.devdaily.com/Dir/Perl/Articles_and_Tutorials/CGI/
> 
> HTH
> 
> John
> 
> -Original Message-
> From: Hockey List [mailto:[EMAIL PROTECTED]]
> Sent: 07 January 2002 15:03
> To: [EMAIL PROTECTED]
> Subject: your my last hope on this cgi programming
> question
> 
> 
> I posted this in a perl forum and was told you all
> might be able to help..
> 
> I was hoping you might point me in the right
> direction
> on a pretty simple problem. I have spent days just
> trying to see HOW to get this done, let alone doing
> it. This seems so damn simply but Im running into a
> brick wall.
> 
> I dabble in Visual Basic, but I am by no means a
> 'programmer'. Im a hockey player and  I have built a
> website for some friends of mine and I would like to
> be able to update some stats.
> 
> If you have a moment, Please take a look at
> http://www.goaliebrotherhood.com and go to the
> members
> stats page. You see my friends and myslelf listed,
> along with our stats.
> 
> Here is my question: How hard would it be to provide
> some input window so that this each of us could
> update
> our stats? Like I said, I dabble in VB and is seems
> pretty simple. But I dont know anything about CGI or
> Pearl... I am willing to learn, like I said, this
> doesnt sound like a mammoth udertaking to me. Its
> pretty simple.
> 
> GP = Games played.. just goes up by 1 each update. W
> +
> L + T = GP
> W/L/T = Win, Loss, Or Tie... Probably a radio button
> and then each value goes up by one, depending on
> which
> button is selected.
> GA = Goals Allowed(not seen).. Total goals allowed
> in
> all games. the goals you let in.. Input box adds to
> the total each update.
> GAA = Goals Against Average.Total Goals Against
> divided by games played.
> 
> Obviously, there would have to be some way to input
> which user you, are, a password enter field and a
> button to clear the stats at the start of a new
> season... Possibly a way to change your password,
> then
> I would need a way to add a new user.. I actually
> did
> get that part built. Check out the site. Pretty
> simple, right... WRONG
> 
> First, I started looking for something remotely
> hosted
> that I could just hook up. It doesnt exist. while
> its
> really simple. its pretty specific to a small niche
> of
> people (hockey goalies) and I cant find anything
> that
> will do it. So I started learning cgi. how hard can
> it
> be to make something this simple? well, I started to
> get the jist of cgi and found out that my website
> host
> (freeservers.com) wont let me into the cgi-bin.. so
> now I not only need to learn cgi and program the
> damn
> thing.. but I need to find a place that will give me
> a
> bin, if that exists.
> 
> Anyway. Thats my dilemma, If you know a good site
> that
> can teach me how to do this, I would really
> appreciate
> hearing about it. funny thing is, even after all
> this
> headache.. I still think this will be better than
> updating by hand, like I have been doing..
> 
> Thanks in advance.
> 
> -Michael #39
> http://www.goaliebrotherhood.com
> [EMAIL PROTECTED]
> 
> 
> 
> 
> 
> 
> 
> 
> =
> The Goalie Brotherhood:
> http://www.goaliebrotherhood.com
> 
> __
> Do You Yahoo!?
> Send FREE video emails in Yahoo! Mail!
> http://promo.yahoo.com/videomail/
> 
> -- 
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 
>
--Confidentiality--.
> This E-mail is confidential.  It should not be read,
> copied, disclosed or
> used by any person other than the intended
> recipient.  Unauthorised use,
> disclosure or copying by whatever medium is strictly
> prohibited and may be
> unlawful.  If you have received this E-mail in error
> please contact the
> sender immediately and delete the E-mail from your
> system.
> 
> 


=
The Goalie Brotherhood:
http://www.goaliebrotherhood.com

__
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




test and question

2002-01-07 Thread Alex Harris



I just joined and have a newbie question.  How can I read in the date of a 
file (mmdd) AND then compare that to another date in Perl?  I'm running 
of and AIX Unix machine.  Please email me direct at [EMAIL PROTECTED]

_
Chat with friends online, try MSN Messenger: http://messenger.msn.com


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Parallel::ForkManager

2002-01-07 Thread James Lucero

Has anyone successfully used the Parallel::ForkManager
to download web pages consistently?  Ultimately I need
to download hundreds/thousands of pages more
efficiently.  I am having two primary problems, 1) its
not very fast for me (although in testing I am only
using 3 or 4 urls so far, I can download many more
pages faster without it).  Also, the results of my
script are inconsistent, sometimes I get all the
requested pages, other times the script errors out  
before getting all the pages, using NT.  I suspect
that I am not properly using the “sub
wait_all_childs”.  I believe that the script quits
prematurely even though I have called the “wait” sub. 
I have inserted it in every place that I can think of
and its still inconsistent.  I’ve included an excerpt
of the code.  I will also try using ParallelUserAgent
to speed up my donwloads, once I get ForkManager to
work. James

use Parallel::ForkManager;
use LWP::Simple;
use LWP::UserAgent ;
use HTTP::Status ;
use HTTP::Request ;
%urls = (   'drudge'=> 'http://www.drudgereport.com',
'rush'  =>
'http://www.rushlimbaugh.com/home/today.guest.html',
'yahoo' => 'http://www.yahoo.com',
'cds' => 'http://www.cdsllc.com/',);
foreach $myURL (sort(values(%urls))) 
{ 
$count++;
print "Count is $count\n";
 $document =  DOCUMENT_RETRIEVER($myURL);
}
sub DOCUMENT_RETRIEVER
{
$myURL=$_[0];
$mit = $myURL;
print "Commencing DOCUMENT_RETRIEVER number $iteration
for $mit\n";
print "Iteration is $iteration and Count is $count\n";

for  ($iteration = $count; $iteration <= $count;
$iteration++)   
{
$name = $iteration;
print "NAME $name\n" ;
my $pm=new Parallel::ForkManager(30);
$pm->start and next;
print "Starting Child Process $iteration for $mit\n" ;
  $ua = LWP::UserAgent->new;
  $ua->agent("$0/0.1 " . $ua->agent);
  $req = new HTTP::Request 'GET' => "$mit";
  $res = $ua->request($req, "$name.html"
print "Process $iteration Complete\n" ;
$pm->finish;
$pm->wait_all_childs;
print "Waiting on children\n";
}
 undef $name;
}  


__
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




pattern matching for ip addresses in a text file

2002-01-07 Thread Ken Yeo

Hi,

What is the best pattern matching for ip addresses? I tried $var =~
/\b\d{1-3}\.\d{1-3}\.\d{1-3}\.\d{1-3}\s/ but the {1-3} didn't work, please
advise, TIA!

Ken Yeo



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




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 back to the list, not diectly to you alone. This is a forum for
sharing questions and answers, not a hook-up for one-to-one help.
http://learn.perl.org/beginners-faq

-Original Message-
From: Alex Harris [mailto:[EMAIL PROTECTED]]
Sent: 07 January 2002 15:21
To: [EMAIL PROTECTED]
Subject: test and question




I just joined and have a newbie question.  How can I read in the date of a 
file (mmdd) AND then compare that to another date in Perl?  I'm running 
of and AIX Unix machine.  Please email me direct at [EMAIL PROTECTED]

_
Chat with friends online, try MSN Messenger: http://messenger.msn.com


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: your my last hope on this cgi programming question

2002-01-07 Thread Hockey List

Oh, Ok.

Thats about the best news Ive heard yet.

Thanks a million!

-M#39
--- John Edwards <[EMAIL PROTECTED]> wrote:
> 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 form, then
> when that form is submitted, store the results. For
> some pointers, take a
> look at this site.
> 
>
http://www.devdaily.com/Dir/Perl/Articles_and_Tutorials/CGI/
> 
> HTH
> 
> John
> 
> -Original Message-
> From: Hockey List [mailto:[EMAIL PROTECTED]]
> Sent: 07 January 2002 15:03
> To: [EMAIL PROTECTED]
> Subject: your my last hope on this cgi programming
> question
> 
> 
> I posted this in a perl forum and was told you all
> might be able to help..
> 
> I was hoping you might point me in the right
> direction
> on a pretty simple problem. I have spent days just
> trying to see HOW to get this done, let alone doing
> it. This seems so damn simply but Im running into a
> brick wall.
> 
> I dabble in Visual Basic, but I am by no means a
> 'programmer'. Im a hockey player and  I have built a
> website for some friends of mine and I would like to
> be able to update some stats.
> 
> If you have a moment, Please take a look at
> http://www.goaliebrotherhood.com and go to the
> members
> stats page. You see my friends and myslelf listed,
> along with our stats.
> 
> Here is my question: How hard would it be to provide
> some input window so that this each of us could
> update
> our stats? Like I said, I dabble in VB and is seems
> pretty simple. But I dont know anything about CGI or
> Pearl... I am willing to learn, like I said, this
> doesnt sound like a mammoth udertaking to me. Its
> pretty simple.
> 
> GP = Games played.. just goes up by 1 each update. W
> +
> L + T = GP
> W/L/T = Win, Loss, Or Tie... Probably a radio button
> and then each value goes up by one, depending on
> which
> button is selected.
> GA = Goals Allowed(not seen).. Total goals allowed
> in
> all games. the goals you let in.. Input box adds to
> the total each update.
> GAA = Goals Against Average.Total Goals Against
> divided by games played.
> 
> Obviously, there would have to be some way to input
> which user you, are, a password enter field and a
> button to clear the stats at the start of a new
> season... Possibly a way to change your password,
> then
> I would need a way to add a new user.. I actually
> did
> get that part built. Check out the site. Pretty
> simple, right... WRONG
> 
> First, I started looking for something remotely
> hosted
> that I could just hook up. It doesnt exist. while
> its
> really simple. its pretty specific to a small niche
> of
> people (hockey goalies) and I cant find anything
> that
> will do it. So I started learning cgi. how hard can
> it
> be to make something this simple? well, I started to
> get the jist of cgi and found out that my website
> host
> (freeservers.com) wont let me into the cgi-bin.. so
> now I not only need to learn cgi and program the
> damn
> thing.. but I need to find a place that will give me
> a
> bin, if that exists.
> 
> Anyway. Thats my dilemma, If you know a good site
> that
> can teach me how to do this, I would really
> appreciate
> hearing about it. funny thing is, even after all
> this
> headache.. I still think this will be better than
> updating by hand, like I have been doing..
> 
> Thanks in advance.
> 
> -Michael #39
> http://www.goaliebrotherhood.com
> [EMAIL PROTECTED]
> 
> 
> 
> 
> 
> 
> 
> 
> =
> The Goalie Brotherhood:
> http://www.goaliebrotherhood.com
> 
> __
> Do You Yahoo!?
> Send FREE video emails in Yahoo! Mail!
> http://promo.yahoo.com/videomail/
> 
> -- 
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 
>
--Confidentiality--.
> This E-mail is confidential.  It should not be read,
> copied, disclosed or
> used by any person other than the intended
> recipient.  Unauthorised use,
> disclosure or copying by whatever medium is strictly
> prohibited and may be
> unlawful.  If you have received this E-mail in error
> please contact the
> sender immediately and delete the E-mail from your
> system.
> 
> 
> 
> -- 
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 


=
The Goalie Brotherhood:
http://www.goaliebrotherhood.com

__
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Parallel::ForkManager

2002-01-07 Thread Randal L. Schwartz

> "James" == James Lucero <[EMAIL PROTECTED]> writes:

James> Has anyone successfully used the Parallel::ForkManager
James> to download web pages consistently?

My series of "Link Checkers" in my columns have had that problem as
well.  The most recent incarnation does a preforking with a
hand-rolled RPC, which I wrote before seeing Parallel::ForkManager,
and can be read about in 

http://www.stonehenge.com/merlyn/LinuxMag/col15.html

and

http://www.stonehenge.com/merlyn/LinuxMag/col16.html

I must say, I'm concerned about this line though:

James> Ultimately I need to download hundreds/thousands of pages more
James> efficiently.

Who's pages?  Are you following the robot protocol?  Are you building
an index?  Do you have permission?

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: your my last hope on this cgi programming question

2002-01-07 Thread Alfred Wheeler

This may help you -
http://www.mycgiserver.com/


Hockey List wrote:

>thats pretty much the main part of the problem.
>
>Like I said, Im not afrain of the cgi. Its the fact
>that the server wont allow me access 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
>>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 form, then
>>when that form is submitted, store the results. For
>>some pointers, take a
>>look at this site.
>>
>>
>http://www.devdaily.com/Dir/Perl/Articles_and_Tutorials/CGI/
>
>>HTH
>>
>>John
>>
>>-Original Message-
>>From: Hockey List [mailto:[EMAIL PROTECTED]]
>>Sent: 07 January 2002 15:03
>>To: [EMAIL PROTECTED]
>>Subject: your my last hope on this cgi programming
>>question
>>
>>
>>I posted this in a perl forum and was told you all
>>might be able to help..
>>
>>I was hoping you might point me in the right
>>direction
>>on a pretty simple problem. I have spent days just
>>trying to see HOW to get this done, let alone doing
>>it. This seems so damn simply but Im running into a
>>brick wall.
>>
>>I dabble in Visual Basic, but I am by no means a
>>'programmer'. Im a hockey player and  I have built a
>>website for some friends of mine and I would like to
>>be able to update some stats.
>>
>>If you have a moment, Please take a look at
>>http://www.goaliebrotherhood.com and go to the
>>members
>>stats page. You see my friends and myslelf listed,
>>along with our stats.
>>
>>Here is my question: How hard would it be to provide
>>some input window so that this each of us could
>>update
>>our stats? Like I said, I dabble in VB and is seems
>>pretty simple. But I dont know anything about CGI or
>>Pearl... I am willing to learn, like I said, this
>>doesnt sound like a mammoth udertaking to me. Its
>>pretty simple.
>>
>>GP = Games played.. just goes up by 1 each update. W
>>+
>>L + T = GP
>>W/L/T = Win, Loss, Or Tie... Probably a radio button
>>and then each value goes up by one, depending on
>>which
>>button is selected.
>>GA = Goals Allowed(not seen).. Total goals allowed
>>in
>>all games. the goals you let in.. Input box adds to
>>the total each update.
>>GAA = Goals Against Average.Total Goals Against
>>divided by games played.
>>
>>Obviously, there would have to be some way to input
>>which user you, are, a password enter field and a
>>button to clear the stats at the start of a new
>>season... Possibly a way to change your password,
>>then
>>I would need a way to add a new user.. I actually
>>did
>>get that part built. Check out the site. Pretty
>>simple, right... WRONG
>>
>>First, I started looking for something remotely
>>hosted
>>that I could just hook up. It doesnt exist. while
>>its
>>really simple. its pretty specific to a small niche
>>of
>>people (hockey goalies) and I cant find anything
>>that
>>will do it. So I started learning cgi. how hard can
>>it
>>be to make something this simple? well, I started to
>>get the jist of cgi and found out that my website
>>host
>>(freeservers.com) wont let me into the cgi-bin.. so
>>now I not only need to learn cgi and program the
>>damn
>>thing.. but I need to find a place that will give me
>>a
>>bin, if that exists.
>>
>>Anyway. Thats my dilemma, If you know a good site
>>that
>>can teach me how to do this, I would really
>>appreciate
>>hearing about it. funny thing is, even after all
>>this
>>headache.. I still think this will be better than
>>updating by hand, like I have been doing..
>>
>>Thanks in advance.
>>
>>-Michael #39
>>http://www.goaliebrotherhood.com
>>[EMAIL PROTECTED]
>>
>>
>>
>>
>>
>>
>>
>>
>>=
>>The Goalie Brotherhood:
>>http://www.goaliebrotherhood.com
>>
>>__
>>Do You Yahoo!?
>>Send FREE video emails in Yahoo! Mail!
>>http://promo.yahoo.com/videomail/
>>
>>-- 
>>To unsubscribe, e-mail:
>>[EMAIL PROTECTED]
>>For additional commands, e-mail:
>>[EMAIL PROTECTED]
>>
>>
>>
>--Confidentiality--.
>
>>This E-mail is confidential.  It should not be read,
>>copied, disclosed or
>>used by any person other than the intended
>>recipient.  Unauthorised use,
>>disclosure or copying by whatever medium is strictly
>>prohibited and may be
>>unlawful.  If you have received this E-mail in error
>>please contact the
>>sender immediately and delete the E-mail from your
>>system.
>>
>>
>
>
>=
>The Goalie Brotherhood:
>http://www.goaliebrotherhood.com
>
>__
>Do You Yahoo!?
>Send FREE video emails in Yahoo! Mail!
>http://promo.yahoo.com/videomail/
>




Re: your my last hope on this cgi programming question

2002-01-07 Thread Hockey List

Yeh, I saw that site last night.

Check this out.. Want to see something funny?

Go to that site, www.myCGIserver right? click on sign
up and read the warning:

"Please note that this service DOES NOT SUPPORT Perl,
PHP or other scripting languages!"

you gotta love the internet!!

-M#39
--- Alfred Wheeler <[EMAIL PROTECTED]>
wrote:
> This may help you -
> http://www.mycgiserver.com/
> 
> 
> Hockey List wrote:
> 
> >thats pretty much the main part of the problem.
> >
> >Like I said, Im not afrain of the cgi. Its the fact
> >that the server wont allow me access 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
> >>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 form, then
> >>when that form is submitted, store the results.
> For
> >>some pointers, take a
> >>look at this site.
> >>
> >>
>
>http://www.devdaily.com/Dir/Perl/Articles_and_Tutorials/CGI/
> >
> >>HTH
> >>
> >>John
> >>
> >>-Original Message-
> >>From: Hockey List [mailto:[EMAIL PROTECTED]]
> >>Sent: 07 January 2002 15:03
> >>To: [EMAIL PROTECTED]
> >>Subject: your my last hope on this cgi programming
> >>question
> >>
> >>
> >>I posted this in a perl forum and was told you all
> >>might be able to help..
> >>
> >>I was hoping you might point me in the right
> >>direction
> >>on a pretty simple problem. I have spent days just
> >>trying to see HOW to get this done, let alone
> doing
> >>it. This seems so damn simply but Im running into
> a
> >>brick wall.
> >>
> >>I dabble in Visual Basic, but I am by no means a
> >>'programmer'. Im a hockey player and  I have built
> a
> >>website for some friends of mine and I would like
> to
> >>be able to update some stats.
> >>
> >>If you have a moment, Please take a look at
> >>http://www.goaliebrotherhood.com and go to the
> >>members
> >>stats page. You see my friends and myslelf listed,
> >>along with our stats.
> >>
> >>Here is my question: How hard would it be to
> provide
> >>some input window so that this each of us could
> >>update
> >>our stats? Like I said, I dabble in VB and is
> seems
> >>pretty simple. But I dont know anything about CGI
> or
> >>Pearl... I am willing to learn, like I said, this
> >>doesnt sound like a mammoth udertaking to me. Its
> >>pretty simple.
> >>
> >>GP = Games played.. just goes up by 1 each update.
> W
> >>+
> >>L + T = GP
> >>W/L/T = Win, Loss, Or Tie... Probably a radio
> button
> >>and then each value goes up by one, depending on
> >>which
> >>button is selected.
> >>GA = Goals Allowed(not seen).. Total goals allowed
> >>in
> >>all games. the goals you let in.. Input box adds
> to
> >>the total each update.
> >>GAA = Goals Against Average.Total Goals Against
> >>divided by games played.
> >>
> >>Obviously, there would have to be some way to
> input
> >>which user you, are, a password enter field and a
> >>button to clear the stats at the start of a new
> >>season... Possibly a way to change your password,
> >>then
> >>I would need a way to add a new user.. I actually
> >>did
> >>get that part built. Check out the site. Pretty
> >>simple, right... WRONG
> >>
> >>First, I started looking for something remotely
> >>hosted
> >>that I could just hook up. It doesnt exist. while
> >>its
> >>really simple. its pretty specific to a small
> niche
> >>of
> >>people (hockey goalies) and I cant find anything
> >>that
> >>will do it. So I started learning cgi. how hard
> can
> >>it
> >>be to make something this simple? well, I started
> to
> >>get the jist of cgi and found out that my website
> >>host
> >>(freeservers.com) wont let me into the cgi-bin..
> so
> >>now I not only need to learn cgi and program the
> >>damn
> >>thing.. but I need to find a place that will give
> me
> >>a
> >>bin, if that exists.
> >>
> >>Anyway. Thats my dilemma, If you know a good site
> >>that
> >>can teach me how to do this, I would really
> >>appreciate
> >>hearing about it. funny thing is, even after all
> >>this
> >>headache.. I still think this will be better than
> >>updating by hand, like I have been doing..
> >>
> >>Thanks in advance.
> >>
> >>-Michael #39
> >>http://www.goaliebrotherhood.com
> >>[EMAIL PROTECTED]
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>=
> >>The Goalie Brotherhood:
> >>http://www.goaliebrotherhood.com
> >>
> >>__
> >>Do You Yahoo!?
> >>Send FREE video emails in Yahoo! Mail!
> >>http://promo.yahoo.com/videomail/
> >>
> >>-- 
> >>To unsubscribe, e-mail:
> >>[EMAIL PROTECTED]
> >>For additional commands, e-mail:
> >>[EMAIL PROTECTED]
> >>
> >>
> >>
>
>--Confidentiality--.
> >
> >>This E-mail is co

RE: your my last hope on this cgi programming question

2002-01-07 Thread John Edwards

This should help

http://www.freewebspace.net/search/advanced.shtml

-Original Message-
From: Hockey List [mailto:[EMAIL PROTECTED]]
Sent: 07 January 2002 16:02
To: Alfred Wheeler
Cc: [EMAIL PROTECTED]
Subject: Re: your my last hope on this cgi programming question


Yeh, I saw that site last night.

Check this out.. Want to see something funny?

Go to that site, www.myCGIserver right? click on sign
up and read the warning:

"Please note that this service DOES NOT SUPPORT Perl,
PHP or other scripting languages!"

you gotta love the internet!!

-M#39
--- Alfred Wheeler <[EMAIL PROTECTED]>
wrote:
> This may help you -
> http://www.mycgiserver.com/
> 
> 
> Hockey List wrote:
> 
> >thats pretty much the main part of the problem.
> >
> >Like I said, Im not afrain of the cgi. Its the fact
> >that the server wont allow me access 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
> >>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 form, then
> >>when that form is submitted, store the results.
> For
> >>some pointers, take a
> >>look at this site.
> >>
> >>
>
>http://www.devdaily.com/Dir/Perl/Articles_and_Tutorials/CGI/
> >
> >>HTH
> >>
> >>John
> >>
> >>-Original Message-
> >>From: Hockey List [mailto:[EMAIL PROTECTED]]
> >>Sent: 07 January 2002 15:03
> >>To: [EMAIL PROTECTED]
> >>Subject: your my last hope on this cgi programming
> >>question
> >>
> >>
> >>I posted this in a perl forum and was told you all
> >>might be able to help..
> >>
> >>I was hoping you might point me in the right
> >>direction
> >>on a pretty simple problem. I have spent days just
> >>trying to see HOW to get this done, let alone
> doing
> >>it. This seems so damn simply but Im running into
> a
> >>brick wall.
> >>
> >>I dabble in Visual Basic, but I am by no means a
> >>'programmer'. Im a hockey player and  I have built
> a
> >>website for some friends of mine and I would like
> to
> >>be able to update some stats.
> >>
> >>If you have a moment, Please take a look at
> >>http://www.goaliebrotherhood.com and go to the
> >>members
> >>stats page. You see my friends and myslelf listed,
> >>along with our stats.
> >>
> >>Here is my question: How hard would it be to
> provide
> >>some input window so that this each of us could
> >>update
> >>our stats? Like I said, I dabble in VB and is
> seems
> >>pretty simple. But I dont know anything about CGI
> or
> >>Pearl... I am willing to learn, like I said, this
> >>doesnt sound like a mammoth udertaking to me. Its
> >>pretty simple.
> >>
> >>GP = Games played.. just goes up by 1 each update.
> W
> >>+
> >>L + T = GP
> >>W/L/T = Win, Loss, Or Tie... Probably a radio
> button
> >>and then each value goes up by one, depending on
> >>which
> >>button is selected.
> >>GA = Goals Allowed(not seen).. Total goals allowed
> >>in
> >>all games. the goals you let in.. Input box adds
> to
> >>the total each update.
> >>GAA = Goals Against Average.Total Goals Against
> >>divided by games played.
> >>
> >>Obviously, there would have to be some way to
> input
> >>which user you, are, a password enter field and a
> >>button to clear the stats at the start of a new
> >>season... Possibly a way to change your password,
> >>then
> >>I would need a way to add a new user.. I actually
> >>did
> >>get that part built. Check out the site. Pretty
> >>simple, right... WRONG
> >>
> >>First, I started looking for something remotely
> >>hosted
> >>that I could just hook up. It doesnt exist. while
> >>its
> >>really simple. its pretty specific to a small
> niche
> >>of
> >>people (hockey goalies) and I cant find anything
> >>that
> >>will do it. So I started learning cgi. how hard
> can
> >>it
> >>be to make something this simple? well, I started
> to
> >>get the jist of cgi and found out that my website
> >>host
> >>(freeservers.com) wont let me into the cgi-bin..
> so
> >>now I not only need to learn cgi and program the
> >>damn
> >>thing.. but I need to find a place that will give
> me
> >>a
> >>bin, if that exists.
> >>
> >>Anyway. Thats my dilemma, If you know a good site
> >>that
> >>can teach me how to do this, I would really
> >>appreciate
> >>hearing about it. funny thing is, even after all
> >>this
> >>headache.. I still think this will be better than
> >>updating by hand, like I have been doing..
> >>
> >>Thanks in advance.
> >>
> >>-Michael #39
> >>http://www.goaliebrotherhood.com
> >>[EMAIL PROTECTED]
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>=
> >>The Goalie Brotherhood:
> >>http://www.goaliebrotherhood.com
> >>
> >>__
> >>Do You Yahoo!?
> >>Send FREE video emails in Yahoo! Ma

Re: pattern matching for ip addresses in a text file

2002-01-07 Thread Jeff 'japhy' Pinyan

On Jan 7, Ken Yeo said:

>What is the best pattern matching for ip addresses? I tried $var =~
>/\b\d{1-3}\.\d{1-3}\.\d{1-3}\.\d{1-3}\s/ but the {1-3} didn't work, please

You want {1,3}, not {1-3}.  Also, should that \s be a \b?  And be warned
that the number 500 matches /\d{1-3}/ without being "legal" for an IP
address.

-- 
Jeff "japhy" Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
 what does y/// stand for?   why, yansliterate of course.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Searching for a book...

2002-01-07 Thread Stanislav Zahariev

Hello,
I'm searching for a perl book to buy... But I'm not sure which is the best, or 
which are the best. Can you refer me some so I can chose from them? I know the basic 
things of perl, if the book holds them they must be very detailed. I'm oriented in 
programming net stuffs with perl. Thanks in advance.

   
   
  best regards,
   
   
  sofit



Re: Searching for a book...

2002-01-07 Thread Richard S. Crawford

Can't go wrong with the Camel Book:  _Programming Perl_, 3rd edition, from 
O'Reilly publishing.  The _Perl Cookbook_, also available from O'Reilly, is 
also an excellent buy.  I have both (in addition to _Learning Perl_, the 
Llama Book), and between them I am almost always able to get the answer to 
my questions.

At 08:31 AM 1/7/2002, you wrote:
> Hello,
> I'm searching for a perl book to buy... But I'm not sure which is the 
> best, or which are the best. Can you refer me some so I can chose from 
> them? I know the basic things of perl, if the book holds them they must 
> be very detailed. I'm oriented in programming net stuffs with perl. 
> Thanks in advance.
>
> 
>best regards,
> 
>sofit


Sliante,
Richard S. Crawford

http://www.mossroot.com
AIM: Buffalo2K   ICQ: 11646404  Y!: rscrawford
MSN: [EMAIL PROTECTED]

"It is only with the heart that we see rightly; what is essential is 
invisible to the eye."  --Antoine de Saint Exupéry

"Push the button, Max!"


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Searching for a book...

2002-01-07 Thread Jon Molin

Stanislav Zahariev wrote:
> 
> Hello,
> I'm searching for a perl book to buy... But I'm not sure which is the best, or 
>which are the best. Can you refer me some so I can chose from them? I know the basic 
>things of perl, if the book holds them they must be very detailed. I'm oriented in 
>programming net stuffs with perl. Thanks in advance.

take a look at http://learn.perl.org/ and try to keep lines shorter

/Jon

> 
>  
>  
> best regards,
>  
>  
> sofit

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




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


If you are after a tutorial not just for Perl, but programming, try The
Elements of Perl Programming


And there's always Learning Perl, which no one should be without


HTH

John

-Original Message-
From: Stanislav Zahariev [mailto:[EMAIL PROTECTED]]
Sent: 07 January 2002 16:32
To: [EMAIL PROTECTED]
Subject: Searching for a book...


Hello,
I'm searching for a perl book to buy... But I'm not sure which is the
best, or which are the best. Can you refer me some so I can chose from them?
I know the basic things of perl, if the book holds them they must be very
detailed. I'm oriented in programming net stuffs with perl. Thanks in
advance.

 
best regards,
 
sofit


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Searching for a book...

2002-01-07 Thread Scott

http://perl.oreilly.com/


At 06:31 PM 1/7/2002 +0200, Stanislav Zahariev wrote:
> Hello,
> I'm searching for a perl book to buy... But I'm not sure which is the 
> best, or which are the best. Can you refer me some so I can chose from 
> them? I know the basic things of perl, if the book holds them they must 
> be very detailed. I'm oriented in programming net stuffs with perl. 
> Thanks in advance.
>
> 
>best regards,
> 
>sofit


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




comparing dates

2002-01-07 Thread Alex Harris



if I use the following to get the date of a file:
use File::stat;
use Time::localtime;
$date_string = ctime(stat($file)->mtime);
print "file $file updated at $date_string\n";

I get:
   Mon Jan  7 10:21:21 2002

Now I want to compare another file date to this one getting the date the 
same way but I don't understand the following example:

sub getdate {
local($_) = shift;
s/-(\d{4})$/+$1/ || s/\+(\d{4})$/-$1/;
# getdate has broken timezone sign reversal!
$_ = `/usr/local/lib/news/newsbin/getdate '$_'`;
chop;
$_;
}

I can't use c modules because they haven't been added and I don't have 
permissions.  TIA

_
Send and receive Hotmail on your mobile device: http://mobile.msn.com


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




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 PROTECTED]]
Sent: 07 January 2002 16:32
To: Stanislav Zahariev
Cc: [EMAIL PROTECTED]
Subject: Re: Searching for a book...


Stanislav Zahariev wrote:
> 
> Hello,
> I'm searching for a perl book to buy... But I'm not sure which is the
best, or which are the best. Can you refer me some so I can chose from them?
I know the basic things of perl, if the book holds them they must be very
detailed. I'm oriented in programming net stuffs with perl. Thanks in
advance.

take a look at http://learn.perl.org/ and try to keep lines shorter

/Jon

> 
>
best regards,
>
sofit

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: pattern matching for ip addresses in a text file

2002-01-07 Thread John W. Krahn

Ken Yeo wrote:
> 
> Hi,

Hello,

> What is the best pattern matching for ip addresses? I tried $var =~
> /\b\d{1-3}\.\d{1-3}\.\d{1-3}\.\d{1-3}\s/ but the {1-3} didn't work, please
> advise, TIA!

The correct syntax is to use a comma. \d{1,3}


John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Searching for a book...

2002-01-07 Thread Jon Molin

John Edwards wrote:
> 
> 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.

i wasn't complaining on the language, i just have 
a hard time reading 299 char long lines. Also, perhaps
you saw that i sent a link with many books?

/Jon

> 
> Take a look at the FAQ section 2.3, bullet point 1 and chill out.
> 
> /John ;)
> 
> -Original Message-
> From: Jon Molin [mailto:[EMAIL PROTECTED]]
> Sent: 07 January 2002 16:32
> To: Stanislav Zahariev
> Cc: [EMAIL PROTECTED]
> Subject: Re: Searching for a book...
> 
> Stanislav Zahariev wrote:
> >
> > Hello,
> > I'm searching for a perl book to buy... But I'm not sure which is the
> best, or which are the best. Can you refer me some so I can chose from them?
> I know the basic things of perl, if the book holds them they must be very
> detailed. I'm oriented in programming net stuffs with perl. Thanks in
> advance.
> 
> take a look at http://learn.perl.org/ and try to keep lines shorter
> 
> /Jon
> 
> >
> >
> best regards,
> >
> sofit
> 
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> --Confidentiality--.
> This E-mail is confidential.  It should not be read, copied, disclosed or
> used by any person other than the intended recipient.  Unauthorised use,
> disclosure or copying by whatever medium is strictly prohibited and may be
> unlawful.  If you have received this E-mail in error please contact the
> sender immediately and delete the E-mail from your system.
> 
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: comparing dates

2002-01-07 Thread Matt C.

Check out Date::Manip; it can do just about anything you'd need to do with dates. If
speed is of great concern (I use Date::Manip and it performs fine), you may be able
to find another Date::* module more specifically tuned to your needs. 

Definitely try Date::Manip first though, as it will work for you. Plus it's easy and
well documented. Looks like you'd want to stat both of your files, then pass the
dates into Date::Manip, where you can do whatever with it.

Matt

--- Alex Harris <[EMAIL PROTECTED]> wrote:
> 
> 
> if I use the following to get the date of a file:
> use File::stat;
> use Time::localtime;
> $date_string = ctime(stat($file)->mtime);
> print "file $file updated at $date_string\n";
> 
> I get:
>Mon Jan  7 10:21:21 2002
> 
> Now I want to compare another file date to this one getting the date the 
> same way but I don't understand the following example:
> 
> sub getdate {
>   local($_) = shift;
>   s/-(\d{4})$/+$1/ || s/\+(\d{4})$/-$1/;
>   # getdate has broken timezone sign reversal!
>   $_ = `/usr/local/lib/news/newsbin/getdate '$_'`;
>   chop;
>   $_;
> }
> 
> I can't use c modules because they haven't been added and I don't have 
> permissions.  TIA
> 
> _
> Send and receive Hotmail on your mobile device: http://mobile.msn.com
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


__
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Searching for a book...

2002-01-07 Thread Stanislav Zahariev


> John Edwards wrote:
> i wasn't complaining on the language, i just have
> a hard time reading 299 char long lines. Also, perhaps
> you saw that i sent a link with many books?
>
> /Jon
>
Sorry, I really haven't think about that in the first way.. My english is a
disaster... I'm a bulgarian. I'm thankful for all the answers. I'll search
what's in the book store depending that I'm in ... that sort of country.
Thanks again!

best regards,
sofit


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: comparing dates

2002-01-07 Thread Yacketta, Ronald

how about converting the times to epoch time and then compare?
have a look at timelocal to convert to epoch time

> -Original Message-
> From: Alex Harris [mailto:[EMAIL PROTECTED]]
> Sent: Monday, January 07, 2002 11:38
> To: [EMAIL PROTECTED]
> Subject: comparing dates
> 
> 
> 
> 
> if I use the following to get the date of a file:
> use File::stat;
> use Time::localtime;
> $date_string = ctime(stat($file)->mtime);
> print "file $file updated at $date_string\n";
> 
> I get:
>Mon Jan  7 10:21:21 2002
> 
> Now I want to compare another file date to this one getting 
> the date the 
> same way but I don't understand the following example:
> 
> sub getdate {
>   local($_) = shift;
>   s/-(\d{4})$/+$1/ || s/\+(\d{4})$/-$1/;
>   # getdate has broken timezone sign reversal!
>   $_ = `/usr/local/lib/news/newsbin/getdate '$_'`;
>   chop;
>   $_;
> }
> 
> I can't use c modules because they haven't been added and I 
> don't have 
> permissions.  TIA
> 
> _
> Send and receive Hotmail on your mobile device: http://mobile.msn.com
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




date compare problems

2002-01-07 Thread Alex Harris




Ok so I'm REALLY REALLY a newbie and this next question is going to sound 
like "where's the spoon" so you can feed me but...
Here's my code and the error I got.  I know it means I'm suppose to include 
something but I'm not sure what.

use File::stat;

   use Time::localtime;
   $date_string = ctime(stat($file)->mtime);
   $date_string2 = ctime(stat("zzp2.txt")->mtime);

   print "$date_string   $date_string2\n";


$date1=&ParseDate($date_string);
$date2=&ParseDate($date_string2);
$flag=&Date_Cmp($date1,$date2);
if ($flag<0) {
   print "date 1 is earlier\n";
} elsif ($flag==0) {
   print "the two dates are identical.\n";
} else {
   print " date2 is earlier\n";
}

errors:
without this: use File::stat;
i got the following

Undefined subroutine &main::ParseDate called at ztest.pl line 19.

when i added: use File::stat;

i got:
Can't locate Date/Manip.pm in @INC (@INC contains: 
/usr/opt/perl5/lib/5.00503/ai
x /usr/opt/perl5/lib/5.00503 /usr/opt/perl5/lib/site_perl/5.005/aix 
/usr/opt/perl5/lib/site_perl/5.005 .)

Does this mean I need to add it to my library and if so HOW!?!??!


_
Join the world’s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: date compare problems

2002-01-07 Thread Yacketta, Ronald

sounds like yah need to install the Manip pacakge


> -Original Message-
> From: Alex Harris [mailto:[EMAIL PROTECTED]]
> Sent: Monday, January 07, 2002 12:26
> To: [EMAIL PROTECTED]
> Subject: date compare problems
> 
> 
> 
> 
> 
> Ok so I'm REALLY REALLY a newbie and this next question is 
> going to sound 
> like "where's the spoon" so you can feed me but...
> Here's my code and the error I got.  I know it means I'm 
> suppose to include 
> something but I'm not sure what.
> 
> use File::stat;
> 
>use Time::localtime;
>$date_string = ctime(stat($file)->mtime);
>$date_string2 = ctime(stat("zzp2.txt")->mtime);
> 
>print "$date_string   $date_string2\n";
> 
> 
> $date1=&ParseDate($date_string);
> $date2=&ParseDate($date_string2);
> $flag=&Date_Cmp($date1,$date2);
> if ($flag<0) {
>print "date 1 is earlier\n";
> } elsif ($flag==0) {
>print "the two dates are identical.\n";
> } else {
>print " date2 is earlier\n";
> }
> 
> errors:
> without this: use File::stat;
> i got the following
> 
> Undefined subroutine &main::ParseDate called at ztest.pl line 19.
> 
> when i added: use File::stat;
> 
> i got:
> Can't locate Date/Manip.pm in @INC (@INC contains: 
> /usr/opt/perl5/lib/5.00503/ai
> x /usr/opt/perl5/lib/5.00503 /usr/opt/perl5/lib/site_perl/5.005/aix 
> /usr/opt/perl5/lib/site_perl/5.005 .)
> 
> Does this mean I need to add it to my library and if so HOW!?!??!
> 
> 
> _
> Join the world's largest e-mail service with MSN Hotmail. 
> http://www.hotmail.com
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: date compare problems

2002-01-07 Thread McCollum, Frank

the &ParseDate, and &Date_Cmp are looking for subroutines that would split
the dates up, it appears.  So, I would expect your code to include a
subroutine similar to this:

sub ParseDate {
($month,$day,$year) = split /\//;
}

but much more detailed to handle different types of date strings.
-Frank
-Original Message-
From: Alex Harris [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 07, 2002 12:26 PM
To: [EMAIL PROTECTED]
Subject: date compare problems





Ok so I'm REALLY REALLY a newbie and this next question is going to sound 
like "where's the spoon" so you can feed me but...
Here's my code and the error I got.  I know it means I'm suppose to include 
something but I'm not sure what.

use File::stat;

   use Time::localtime;
   $date_string = ctime(stat($file)->mtime);
   $date_string2 = ctime(stat("zzp2.txt")->mtime);

   print "$date_string   $date_string2\n";


$date1=&ParseDate($date_string);
$date2=&ParseDate($date_string2);
$flag=&Date_Cmp($date1,$date2);
if ($flag<0) {
   print "date 1 is earlier\n";
} elsif ($flag==0) {
   print "the two dates are identical.\n";
} else {
   print " date2 is earlier\n";
}

errors:
without this: use File::stat;
i got the following

Undefined subroutine &main::ParseDate called at ztest.pl line 19.

when i added: use File::stat;

i got:
Can't locate Date/Manip.pm in @INC (@INC contains: 
/usr/opt/perl5/lib/5.00503/ai
x /usr/opt/perl5/lib/5.00503 /usr/opt/perl5/lib/site_perl/5.005/aix 
/usr/opt/perl5/lib/site_perl/5.005 .)

Does this mean I need to add it to my library and if so HOW!?!??!


_
Join the world's largest e-mail service with MSN Hotmail. 
http://www.hotmail.com


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: comparing dates

2002-01-07 Thread John W. Krahn

Alex Harris wrote:
> 
> if I use the following to get the date of a file:
> use File::stat;
> use Time::localtime;
> $date_string = ctime(stat($file)->mtime);
> print "file $file updated at $date_string\n";
> 
> I get:
>Mon Jan  7 10:21:21 2002
> 
> Now I want to compare another file date to this one getting the date the
> same way but I don't understand the following example:
> 
> [snip]

my $date1 = stat( $file1 )->mtime;
my $date2 = stat( $file2 )->mtime;

if ( $date1 < $date2 ) {
print "$file1 is older than $file2\n";
}
elsif ( $date2 < $date1 ) {
print "$file2 is older than $file1\n";
}
else {
print "$file1 and $file2 were modified at the same time.\n";
}


John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: date compare problems

2002-01-07 Thread John W. Krahn

Alex Harris wrote:
> 
> Ok so I'm REALLY REALLY a newbie and this next question is going to sound
> like "where's the spoon" so you can feed me but...
> Here's my code and the error I got.  I know it means I'm suppose to include
> something but I'm not sure what.

You are making this _way_ too complicated.  The stat() function returns
the mtime in the number of seconds since the epoch.  You then convert
that to a string using ctime() and _then_ parse the date from the string
to a number to compare it to another date.


> use File::stat;
> 
>use Time::localtime;
>$date_string = ctime(stat($file)->mtime);
>$date_string2 = ctime(stat("zzp2.txt")->mtime);
> 
>print "$date_string   $date_string2\n";
> 
> $date1=&ParseDate($date_string);
> $date2=&ParseDate($date_string2);
> $flag=&Date_Cmp($date1,$date2);
> if ($flag<0) {
>print "date 1 is earlier\n";
> } elsif ($flag==0) {
>print "the two dates are identical.\n";
> } else {
>print " date2 is earlier\n";
> }

#!/usr/bin/perl -w
use strict;

# Get the mtime from two files
my $date1 = (stat $file)[9];
my $date2 = (stat 'zzp2.txt')[9];

print scalar $date1, '   ', scalar $date2, "\n";

if ( $date1 < $date2 ) {
print "$file is older than zzp2.txt.\n";
}
elsif ( $date2 < $date1 ) {
print "zzp2.txt is older than $file.\n";
}
else {
print "the two dates are identical.\n";
}

__END__


John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: EXCEL automation

2002-01-07 Thread Ryan Guy

Maybe youre just a wuss.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Variable interpolation?

2002-01-07 Thread Mad B . Jones

06/01/02 17:20:37, Jeff 'japhy' Pinyan <[EMAIL PROTECTED]> a écrit:

>The contents of @string are raw text.  You'll need to expand the variables
>in it manually:
>
>  perldoc -q 'expand variables'
>
>That FAQ will tell you what to do.

Thanks, Jeff, for taking the time to answer.

My problem was, as a beginner, that I didn't know where to start looking in the 
documentation, since I didn't know what the problem was :)


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: SubRoutine Help

2002-01-07 Thread Michael R. Wolf

[EMAIL PROTECTED] (John W. Krahn) writes:

> "Michael R. Wolf" wrote:

[buggy code deleted ...]

> $ perl -le'
> @fred = qw(1 3 5 7 9);
> sub total {
> my $sum;
> $sum += $_ foreach (@_);
> }
   # undef from final foreach always returned
> print total( @fred );
> '
>

My bad!  Sorry.  I'm working on a laptop (with about 5M, yes
M, extra disk space) away from my Perl environment.  No room
to set up the envorienment that I should have to prevent
posting buggy code.

The last "executed" expression was the failing loop
iteration, therefore, that's what was returned.  (I even
thought about it for a couple of minutes before I posted it!
And I got it wrong.  Nothing like running Perl through perl
(instead of my grey matter) to get the right answer.  I got
bit by my own hubris.  I tried to make it as small as
possible, but I made it _too_ small.  I got distracted by
checking the docs to confirm that the return value of an
incrementing assignment was the newly incremented value.  I
forgot to consider the final loop iteration.)

Add either of these lines before the closing brace to fix my
buggy code.

$sum;# Perl guru-ish.
return $sum  # The way I really do it.  Old C habits die hard.

-- 
Michael R. Wolf
All mammals learn by playing!
[EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




who is the method cop?

2002-01-07 Thread Skip Montanaro


I'm trying to figure out Perl's object-oriented features.  I'm a long-time
Python programmer, so I'm well-versed in its notion of OO programming, but
Perl's method definition stuff seems a bit "loose".  All of my Perl
programming is in a Mason context, so that's where I'll pull an example.
Let's see, here's a simple enough example.  These two methods are from
HTML::Mason::ApacheHandler.

sub new
{
my ($class,%options) = @_;
my $interp = $options{interp} or die 
"HTML::Mason::Request::ApacheHandler::new: must specify interp\n";
delete $options{interp};
my $self = $class->SUPER::new(interp=>$interp);
while (my ($key,$value) = each(%options)) {
if (exists($reqfields{$key})) {
$self->{$key} = $value;
} else {
die "HTML::Mason::Request::ApacheHandler::new: invalid option 
'$key'\n";
}
}
return $self;
}

# Override flush_buffer to also call $r->rflush
sub flush_buffer
{
my ($self, $content) = @_;
$self->SUPER::flush_buffer($content);
$self->apache_req->rflush;
}

I understand the assignment to $self and $class.  What I don't understand is
how new and flush_buffer are associated with a specific class.  For example,
is there anything that keeps me from calling flush_buffer with an instance
of a class other than ApacheHandler or calling new with some other class?
Should the class author be doing some type checking?

Thanks,

-- 
Skip Montanaro ([EMAIL PROTECTED] - http://www.mojam.com/)

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: EXCEL automation

2002-01-07 Thread Stout, Joel R

Not sure, but if you go to Window -> Unhide you can see that the book was
created successfully.  Maybe a Win32 Perl Guru can help more.

Joel

> -Original Message-
> From: Billie [mailto:[EMAIL PROTECTED]]
> Sent: Monday, January 07, 2002 7:15 AM
> To: [EMAIL PROTECTED]
> Subject: EXCEL automation
> 
> 
> Hi all,
> 
> What's wrong  with the following code?
> 
> use Win32::OLE;
> $book = Win32::OLE->GetObject("Book1.xls");
> $book->Saveas("Book2.xls");
> 
> Book1 and the script are in the same directory.  When I open 
> Book2.xls, I
> cannot see any worksheet. Why?
> 
> Thanks
> Billie
> 
> 
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




perl sleep

2002-01-07 Thread Scott

I have been asked to rewrite a ftp process in perl on Win32.  The program 
will scan a directory
every five minutes and if a file exists, it will ftp the file to a server.

My question is, has any had an experience using the Windows Task Scheduler 
to do a every 5
minute process or do you think it would be best to have perl sleep for 5 
minutes?

Thanks,

-Scott


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: who is the method cop?

2002-01-07 Thread Peter Scott

At 12:27 PM 1/7/02 -0600, Skip Montanaro wrote:

>I'm trying to figure out Perl's object-oriented features.  I'm a long-time 
>Python programmer, so I'm well-versed in its notion of OO programming, but 
>Perl's method definition stuff seems a bit "loose".

Yes, we like it that way :-)

>sub new
> {
> my ($class,%options) = @_;
> my $interp = $options{interp} or die 
> "HTML::Mason::Request::ApacheHandler::new: must specify interp\n";
> delete $options{interp};
> my $self = $class->SUPER::new(interp=>$interp);
> while (my ($key,$value) = each(%options)) {
> if (exists($reqfields{$key})) {
> $self->{$key} = $value;
> } else {
> die "HTML::Mason::Request::ApacheHandler::new: invalid 
> option '$key'\n";
> }
> }
> return $self;
> }
>
> # Override flush_buffer to also call $r->rflush
> sub flush_buffer
> {
> my ($self, $content) = @_;
> $self->SUPER::flush_buffer($content);
> $self->apache_req->rflush;
> }
>
>I understand the assignment to $self and $class.  What I don't understand is
>how new and flush_buffer are associated with a specific class.  For example,
>is there anything that keeps me from calling flush_buffer with an instance
>of a class other than ApacheHandler or calling new with some other class?

Only if that class inherits from the class the method is defined 
in.  Otherwise there's no way for Perl to find that code.

>Should the class author be doing some type checking?

I've never seen anyone bother.  I suppose you could check $class or ref 
$self against __PACKAGE__ if you wanted to make sure that no-one could call 
your methods from a subclass, but that sounds very antisocial.
--
Peter Scott
Pacific Systems Design Technologies
http://www.perldebugged.com


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: perl sleep

2002-01-07 Thread Tisdel, Matthew

This used to be the method that MRTG used on a NT machine. The newer
versions do not do this, so you will have to find older versions with docs
that tell you how to do it. Actually, I remember there being an NT script,
or little Perl program that added all of this for you. I got the following
from this page, http://noc.nol.net/mirrors/mrtg/mrtg.html, which is an
archive of some sort of older versions of the mrtg web site. The current
page is www.mrtg.org.

$interval=300;
  while (1) {
sleep( $interval - time() % $interval );
system 'c:\bin\perl c:\mrtg-2.7.4\run\mrtg c:\mrtg-2.7.4\run\mrtg.cfg';
  }   
  




Matthew J. Tisdel
Service Resources, Inc.
864 272-2777

-Original Message-
From: Scott [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 07, 2002 1:45 PM
To: [EMAIL PROTECTED]
Subject: perl sleep

I have been asked to rewrite a ftp process in perl on Win32.  The program
will scan a directory
every five minutes and if a file exists, it will ftp the file to a server.

My question is, has any had an experience using the Windows Task Scheduler
to do a every 5
minute process or do you think it would be best to have perl sleep for 5
minutes?

Thanks,

-Scott


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: who is the method cop?

2002-01-07 Thread Jonathan E. Paton


> I'm trying to figure out Perl's object-oriented features.
> I'm a long-time Python Programmer, so I'm well-versed in
> its notion of OO programming, but Perl's method
> definition stuff seems a bit "loose".  All of my Perl
> programming is in a Mason context, so that's where I'll
> pull an example.  Let's see, here's a simple enough
> example.  These two methods are from
> HTML::Mason::ApacheHandler.
>
> [SNIP]
> 
> # Override flush_buffer to also call $r->rflush
> sub flush_buffer
> {
> my ($self, $content) = @_;
> $self->SUPER::flush_buffer($content);
> $self->apache_req->rflush;
> }
> 
> I understand the assignment to $self and $class.  What
> I don't understand is how new and flush_buffer are
> associated with a specific class.  For example, is there
> anything that keeps me from calling flush_buffer with an
> instance of a class other than ApacheHandler or calling
> new with some other class?  Should the class author be
> doing some type checking?

Type checking is for wimps ;)  Do you send normally try to
send Square objects to RoundHole objects?  If you do, I bet
you didn't read the API documentation.  Most of the time it
doesn't matter, but if you care there are modules on CPAN
to add type checking.

The association between methods and classes is done by
packages.  You'll notice this example resides in the
HTML::Mason::ApacheHandler package.

To make this clear, in Perl OOP you use:

Packages as classes.
Subroutines as instance methods/class methods.
Package variables for class variables.
Blessed variables for object instances.

To be an object the package name MUST be the same as the
filename.

I think I've got all this right...

Jonathan Paton

__
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: perl sleep

2002-01-07 Thread Stout, Joel R

Here a little daemon that runs my Perl FTP program with different job cards.
It runs every 5 minutes.  

#!/usr/bin/perl -w
use strict;
use POSIX;

# Start the loop for the daemon
while(1) {
my(@now) = localtime();
my($today) = POSIX::strftime( "%m/%d/%Y", @now);
my($time) = POSIX::strftime( "%H:%M", @now);
print "Running 5 minute jobs | $today | $time\n"; 

system ( 'perl newftp2.pl gep_card.xml' );
system ( 'perl newftp2.pl gel_card.xml' );
system ( 'perl newftp2.pl met_card.xml' );
system ( 'perl newftp2.pl nor_card.xml' );
system ( 'perl newftp2.pl pet_card.xml' );  
system ( 'perl newftp2.pl th_jua_card.xml' );   
system ( 'perl newftp2.pl th_del_card.xml' );   
system ( 'perl newftp2.pl th_chi_card.xml' );

sleep 300;  # 5 minute intervals   
}

I used to do this with NT Scheduler (if you have to do it that way go to
Advanced options and you can repeat every x minutes) but I found that the
Perl daemon was easier.  Also since my production box is my pc (ack) I don't
have a MS Window popping up every 5 minutes like you will have with the
scheduler.

Hope this helps...

Joel

> -Original Message-
> From: Scott [mailto:[EMAIL PROTECTED]]
> Sent: Monday, January 07, 2002 10:44 AM
> To: [EMAIL PROTECTED]
> Subject: perl sleep
> 
> 
> I have been asked to rewrite a ftp process in perl on Win32.  
> The program 
> will scan a directory
> every five minutes and if a file exists, it will ftp the file 
> to a server.
> 
> My question is, has any had an experience using the Windows 
> Task Scheduler 
> to do a every 5
> minute process or do you think it would be best to have perl 
> sleep for 5 
> minutes?
> 
> Thanks,
> 
> -Scott
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Threads

2002-01-07 Thread Mark Maunder

RAHUL SHARMA wrote:

> Can anyone please help me if I can use threads in perl;
>
> If yes then what all library files I have to include.
>
> Thanks,
>
> Rahul.

Perl supports threads, but it's not mature technology yet. You may need
to compile your own version of Perl as the default install doesn't
support threads. Have you considered using fork() instead?



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: date compare problems

2002-01-07 Thread Matt C.

It looks very much like you've not installed the Date::Manip module on your system.
Have you?

If not try this at the command-line:

perl -MCPAN -eshell

then tell it:  

install Date::Manip 


And watch it roll. You may need your sys admin to run 'make install' on it, however.
In fact, you may want to just ask them to install it for you...

MC
--- Alex Harris <[EMAIL PROTECTED]> wrote:
> 
> 
> 
> Ok so I'm REALLY REALLY a newbie and this next question is going to sound 
> like "where's the spoon" so you can feed me but...
> Here's my code and the error I got.  I know it means I'm suppose to include 
> something but I'm not sure what.
> 
> use File::stat;
> 
>use Time::localtime;
>$date_string = ctime(stat($file)->mtime);
>$date_string2 = ctime(stat("zzp2.txt")->mtime);
> 
>print "$date_string   $date_string2\n";
> 
> 
> $date1=&ParseDate($date_string);
> $date2=&ParseDate($date_string2);
> $flag=&Date_Cmp($date1,$date2);
> if ($flag<0) {
>print "date 1 is earlier\n";
> } elsif ($flag==0) {
>print "the two dates are identical.\n";
> } else {
>print " date2 is earlier\n";
> }
> 
> errors:
> without this: use File::stat;
> i got the following
> 
> Undefined subroutine &main::ParseDate called at ztest.pl line 19.
> 
> when i added: use File::stat;
> 
> i got:
> Can't locate Date/Manip.pm in @INC (@INC contains: 
> /usr/opt/perl5/lib/5.00503/ai
> x /usr/opt/perl5/lib/5.00503 /usr/opt/perl5/lib/site_perl/5.005/aix 
> /usr/opt/perl5/lib/site_perl/5.005 .)
> 
> Does this mean I need to add it to my library and if so HOW!?!??!
> 
> 
> _
> Join the world’s largest e-mail service with MSN Hotmail. 
> http://www.hotmail.com
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


__
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: who is the method cop?

2002-01-07 Thread Peter Scott

At 01:02 PM 1/7/02 -0600, Skip Montanaro wrote:
>>> I understand the assignment to $self and $class.  What I don't
> >> understand is how new and flush_buffer are associated with a specific
> >> class.  For example, is there anything that keeps me from calling
> >> flush_buffer with an instance of a class other than ApacheHandler or
> >> calling new with some other class?
>
> Peter> Only if that class inherits from the class the method is defined
> Peter> in.  Otherwise there's no way for Perl to find that code.
>
> >> Should the class author be doing some type checking?
>
> Peter> I've never seen anyone bother.  I suppose you could check $class
> Peter> or ref $self against __PACKAGE__ if you wanted to make sure that
> Peter> no-one could call your methods from a subclass, but that sounds
> Peter> very antisocial.
>
>I wasn't thinking about being antisocial.  Perhaps Perl's packaging
>structure prevents the problem I'm worrying about?

Exactly.

>  In Python, you can
>easily define two classes in the same file.  There's no confusion between
>the methods of the two classes because the method definitions are nested in
>the class's definitions, e.g.:
>
> class Foo:
> def __init__(self, ...):
> do_fun_stuff()
>
> class Bar:
> def __init__(self, ...):
> do_other_fun_stuff()

Python::Perlclass::package

>There's no way you could accidentally initialize a Foo object with the
>__init__ method for Bar objects.  I guess that's what I was getting at.
>Since the ApacheHandler's new method is defined at the outermost scope of
>the file, what keeps it from (accidentally?) being called to initialize some
>other object?

Methods live in packages, not lexical scopes.
--
Peter Scott
Pacific Systems Design Technologies
http://www.perldebugged.com


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Perl2Exe (or Compiled Perl) and Shipping Runnable Source

2002-01-07 Thread Morbus Iff

Hey all,

To summarize, my impresssion of people's hatred of Perl2Exe
or generically, compiled ("hidden source") perl is:

  - it hides the source from the user. this goes against Perl,
and you really should be using another language if you want
to be such a Nazi.

I totally agree with this. Now, the caveat: *I* ship compiled Perl 
applications, primarily AmphetaDesk [1], which is available for Mac and PC. 
My primary reason of shipping compiled is:

  - it saves the user from having to download a large Perl
installation, and learning how to interact with Perl
and CPAN. I cater to the lowest common denominator in
*everything* I do. If it's not easy, then I won't ship
it - this extends OUTSIDE of Perl - if the download
is to long, or the install process isn't easy, then
those are problems too.

So, I started thinking of how to merge both of those two ideals. My initial 
thought, and why I'm writing this email, is use / require / do. The idea is 
to write a wrapper exe that simply loads in, at runtime, the pure perl 
code. Roughly:

- all real source code under "/src/"
- a wrapper.pl script under "/" that contains all
  module declarations, path determinations, etc,
  that contains, simple "do /src/mainscript.pl" or
  "use src/mainscript.lib", etc.

This wrapper.pl would then be turned into the wrapper.exe that is created 
from runtime builders like perl2exe or MacPerl. The wrapper.exe would 
contain all the CPAN modules, all other modules used, and any XS libraries 
needed. The actual application source code would be shipped as plain text. 
In this case, we satisfy the first requirement:

  - the perl interpreter, all modules, and XS libraries are contained
in one binaried app, which prevents the need for additional
downloading and installation.

It also satisfies the second requirement:

  - all source code for the app is shipped plain text, in /src/.

Now, the inevitable questions:

  - how do the naysayers and the users feel about this?
  - what do you see can break about this implementation?

Once I get more time, I'll be trying this approach on my own AmphetaDesk.

[1] http://www.disobey.com/amphetadesk/


--
Morbus Iff ( softcore vulcan pr0n rulez )
http://www.disobey.com/ && http://www.gamegrene.com/
please me: http://www.amazon.com/exec/obidos/wishlist/25USVJDH68554
icq: 2927491 / aim: akaMorbus / yahoo: morbus_iff / jabber.org: morbus




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: perl sleep

2002-01-07 Thread Scott

Thank you to everyone for the help.  I think the timer should be easy enough
to implement in perl.  My concern was memory usage with the NT task scheduler
and would rather have perl do the chore.


At 06:52 PM 1/7/2002 +, Stout, Joel R wrote:
>I used to do this with NT Scheduler (if you have to do it that way go to
>Advanced options and you can repeat every x minutes) but I found that the
>Perl daemon was easier.  Also since my production box is my pc (ack) I don't
>have a MS Window popping up every 5 minutes like you will have with the
>scheduler.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: CGI perl html urgent

2002-01-07 Thread Prahlad Vaidyanathan

Hi,

On Sun, 06 Jan 2002 Brett W. McCoy spewed into the ether:
[-- snip --]
> You shouldn't use WordPad for writing Perl code (or any kind of code), you
> should get some kind of programmer's editor that can do syntax
> highlighting and has some kind of smarts about the syntax of the language
> you are writing in, so you'll know that you have unmatched parentheses or
> braces.  There are plenty to choose from, both free and non-free.
> 
> I personally use emacs (both on Windows & Unix), but you should find one
> you like.

Does emacs do syntax highlighting ? I've been using Vim for a very long
time now, but last time I checked Emacs didn't do it.


pv.
-- 
Prahlad Vaidyanathan <[EMAIL PROTECTED]>

In vino veritas.
[In wine there is truth.]
-- Pliny

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Stripping records

2002-01-07 Thread Scott

Hi:

I have a file that contains a header row, I want to remove the first line 
and start processing
on the second line.  Would you recommend using seek to scan for the last 
word in the first line?

Thanks,

-Scott


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




substitute all non-digits with ''. I think I saw this posted recently, but I could not find it...

2002-01-07 Thread McCollum, Frank

I want to take all non-digits and drop them out of my string.  I would think
it would be something like...

s/!(\d+)//;  but this is not the case



Frank McCollum
Bank Of America Securities, LLC
[EMAIL PROTECTED]
(704) 388-8894

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Stripping records

2002-01-07 Thread Wagner-David

If straight text, then could just read the first line and start on the second:
my $MyHdrLine = ; # get first line
WHILE (  ) {

   }

You have bypassed first line(has carriage return still with it.
Now you start your processing.

Wags ;)

-Original Message-
From: Scott [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 07, 2002 12:00
To: [EMAIL PROTECTED]
Subject: Stripping records


Hi:

I have a file that contains a header row, I want to remove the first line 
and start processing
on the second line.  Would you recommend using seek to scan for the last 
word in the first line?

Thanks,

-Scott


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: your my last hope on this cgi programming question

2002-01-07 Thread Alan C.

Hi,

http://www.delphiforums.com/


I originally discovered the follows site from being a member at above site.

I'm a member at above of which I can first log on there which then entitles 
me to freely travel/navigate follows/next site

without logged on to above, membership (free) perl.about.com registration 
may be required to use follows


perl.about.com  cgi-perl (free) class I'm in middle of it myself

http://perl.about.com/library/p101/bl_p101class.htm


perl.about.com cgi-perl forum start page

http://forums.about.com/n/main.asp?webtag=ab-perl&nav=start


perl.about.com  subject/topic index

http://perl.about.com/

-

I finding the class great.  (it's self paced can go at your own pace) But 
the 10 week class be more like 20 plus weeks for me.  my unsupported 
opinion that the latter 35% to 55% of the class gets feet wet on 
intermediate-advanced things.

Somewhere on the various categories of forum posts, a thread or maybe an 
article under the subject/topic index I had seen about cgi-bin availability 
various sites around the www.

Regards.  Alan.

At 07:20 AM 1/7/2002 -0800, you wrote:
>thats pretty much the main part of the problem.
>
>Like I said, Im not afrain of the cgi. Its the fact
>that the server wont allow me access to the cgi bin at
>all..
>
>anyone know a free server for a cgi-bin?



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: substitute all non-digits with ''. I think I saw this posted rec ently, but I could not find it...

2002-01-07 Thread Tanton Gibbs

\D means anything that is not a digit, so

$str = "AB123CD";
$str =~ s/\D//g;

will work.

Also, you could use tr

$str =~ tr/0-9//d;
- Original Message -
From: "McCollum, Frank" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, January 07, 2002 2:52 PM
Subject: substitute all non-digits with ''. I think I saw this posted rec
ently, but I could not find it...


> I want to take all non-digits and drop them out of my string.  I would
think
> it would be something like...
>
> s/!(\d+)//;  but this is not the case
>
>
>
> Frank McCollum
> Bank Of America Securities, LLC
> [EMAIL PROTECTED]
> (704) 388-8894
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: substitute all non-digits with ''. I think I saw this posted recently, but I could not find it...

2002-01-07 Thread McCollum, Frank

Aha. That is very familiar.  Thx.

-Original Message-
From: Tanton Gibbs [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 07, 2002 2:54 PM
To: McCollum, Frank; [EMAIL PROTECTED]
Subject: Re: substitute all non-digits with ''. I think I saw this
posted rec ently, but I could not find it...


\D means anything that is not a digit, so

$str = "AB123CD";
$str =~ s/\D//g;

will work.

Also, you could use tr

$str =~ tr/0-9//d;
- Original Message -
From: "McCollum, Frank" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, January 07, 2002 2:52 PM
Subject: substitute all non-digits with ''. I think I saw this posted rec
ently, but I could not find it...


> I want to take all non-digits and drop them out of my string.  I would
think
> it would be something like...
>
> s/!(\d+)//;  but this is not the case
>
>
>
> Frank McCollum
> Bank Of America Securities, LLC
> [EMAIL PROTECTED]
> (704) 388-8894
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Stripping records

2002-01-07 Thread John W. Krahn

Scott wrote:
> 
> Hi:

Hello,

> I have a file that contains a header row, I want to remove the first line
> and start processing
> on the second line.  Would you recommend using seek to scan for the last
> word in the first line?

open FILE, $file or die "Cannot open $file: $!";

;  # read first line in a void context

while (  ) {
# second and subsequent lines are in $_
...
}



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: substitute all non-digits with ''. I think I saw this posted rec ently, but I could not find it...

2002-01-07 Thread Wagner-David

Might be faster and easier to use tr:

tr/0-9//c ; # take complement of what is in string1 and replace w/ 
string2(null in this case)

Wags ;)

-Original Message-
From: McCollum, Frank [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 07, 2002 11:53
To: [EMAIL PROTECTED]
Subject: substitute all non-digits with ''. I think I saw this posted
rec ently, but I could not find it...


I want to take all non-digits and drop them out of my string.  I would think
it would be something like...

s/!(\d+)//;  but this is not the case



Frank McCollum
Bank Of America Securities, LLC
[EMAIL PROTECTED]
(704) 388-8894

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: substitute all non-digits with ''. I think I saw this posted rec ently, but I could not find it...

2002-01-07 Thread John W. Krahn

Tanton Gibbs wrote:
> 
> From: "McCollum, Frank" <[EMAIL PROTECTED]>
> >
> > I want to take all non-digits and drop them out of my
> > string.  I would think it would be something like...
> >
> > s/!(\d+)//;  but this is not the case
> \D means anything that is not a digit, so
> 
> $str = "AB123CD";
> $str =~ s/\D//g;
> 
> will work.
> 
> Also, you could use tr
> 
> $str =~ tr/0-9//d;

The OP wants to remove non-digits so:

$str =~ tr/0-9//cd;



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Stripping records

2002-01-07 Thread Jonathan E. Paton

> Hi:
>
> I have a file that contains a header row, I want to
> remove the first line and start processing on the second
> line.  Would you recommend using seek to scan for the
> last word in the first line?

Another solution is:

# Skip over line 1, adds overhead to all iterations though.
while () {
  next if 1..1;# Skip lines from 1 to 1
   # ---OR---
  next if ($.==1); # Skip specifically line 1
}

or:

# Discard line 1
while (<>) { last unless $.<2 }

Jonathan Paton


__
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Fw: substitute all non-digits with ''. I think I saw this posted rec ently, but I could not find it...

2002-01-07 Thread Tanton Gibbs


- Original Message -
From: "Tanton Gibbs" <[EMAIL PROTECTED]>
To: "Tanton Gibbs" <[EMAIL PROTECTED]>
Sent: Monday, January 07, 2002 3:06 PM
Subject: Re: substitute all non-digits with ''. I think I saw this posted
rec ently, but I could not find it...


> oops :)  forgot the c on my tr
>
> $str =~ tr/0-9//cd;
> - Original Message -
> From: "Tanton Gibbs" <[EMAIL PROTECTED]>
> To: "McCollum, Frank" <[EMAIL PROTECTED]>;
> <[EMAIL PROTECTED]>
> Sent: Monday, January 07, 2002 2:53 PM
> Subject: Re: substitute all non-digits with ''. I think I saw this posted
> rec ently, but I could not find it...
>
>
> > \D means anything that is not a digit, so
> >
> > $str = "AB123CD";
> > $str =~ s/\D//g;
> >
> > will work.
> >
> > Also, you could use tr
> >
> > $str =~ tr/0-9//d;
> > - Original Message -
> > From: "McCollum, Frank" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Monday, January 07, 2002 2:52 PM
> > Subject: substitute all non-digits with ''. I think I saw this posted
rec
> > ently, but I could not find it...
> >
> >
> > > I want to take all non-digits and drop them out of my string.  I would
> > think
> > > it would be something like...
> > >
> > > s/!(\d+)//;  but this is not the case
> > >
> > >
> > >
> > > Frank McCollum
> > > Bank Of America Securities, LLC
> > > [EMAIL PROTECTED]
> > > (704) 388-8894
> > >
> > > --
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> >
> >
> > --
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: substitute all non-digits with ''. I think I saw this postedrec ently, but I could not find it...

2002-01-07 Thread John W. Krahn

Wagner-David wrote:
> 
> Might be faster and easier to use tr:
> 
> tr/0-9//c ; # take complement of what is in string1 and replace w/ 
>string2(null in this case)

This will replace the complement of 0-9 with the complement of 0-9.  It
doesn't change the original string at all.  You have to use the /d
modifier to actually delete something.

tr/0-9//cd;


John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




PerlEz question

2002-01-07 Thread SathishDuraisamy

This is more like a non-PERL question...but since it involves PerlEz.dll I
am addressing this mailing-list :-)
I need to have my servlets invoke a PERL subroutine through PerlEz.dll
(using JNI) on the web server side. The PERL subroutine may take few seconds
to perform its job. PerlEz documentation says that ONLY ONE instance of the
PERL Interpretor can be RUN at a time though we can CREATE many instances.
My question is, if I happen to have 100 clients invoke their servlets
simultaneously will there be any bottleneck in the performence with respect
to the Response Time?  Anybody with PerlEz and CGI experience, please let me
know your opinion. 

Thanks in advance,
Sathish Duraisamy


 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: who is the method cop?

2002-01-07 Thread Michael Fowler

On Mon, Jan 07, 2002 at 12:27:26PM -0600, Skip Montanaro wrote:
> I understand the assignment to $self and $class.  What I don't understand is
> how new and flush_buffer are associated with a specific class.  For example,
> is there anything that keeps me from calling flush_buffer with an instance
> of a class other than ApacheHandler or calling new with some other class?

To expand a bit on what others have said, no, there is nothing stopping you. 
However, to do so the object you're using has to either inherit from the
ApacheHandler class, or you have to bypass the method call syntax. 
Regarding the latter, here's an example:

my $obj = SomeFunkyClass->new();
ApacheHandler($obj);

In practice, few people go to the trouble.  If they do go to the trouble,
then they're doing it for a reason, and should know enough about what
they're doing so as not to shoot themselves in the foot.


> Should the class author be doing some type checking?

As mentioned by others, you can do some type checking.  However, once you
start checking the type you start restricting how others can use your class. 
One example is with the __PACKAGE__ check Peter Scott mentioned.  Once you
check against __PACKAGE__ (which, if you aren't familiar with it, evaluates
to the name of the current package at compile-time) you remove the ability
to subclass.  If you really want to do checking I would suggest using
UNIVERSAL::isa().  However, most class authors don't do checking, under the
assumption that users are using the class as documented, and that if they
aren't, they are going to expect problems.


Michael
--
Administrator  www.shoebox.net
Programmer, System Administrator   www.gallanttech.com
--

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




About DBD-ODBC Module

2002-01-07 Thread Jose Vicente

I can't install the module because I get some errors, when I read README file i find 
this:

BUILDING:
 

   set-up these environment variables:
 DBI_DSN   The dbi data source, e.g. 'dbi:ODBC:YOUR_DSN_HERE'
 DBI_USER  The username to use to connect to the database
 DBI_PASS  The username to use to connect to the database
 ODBCHOME  (Unix only) The dir your driver manager is installed in

But I don't understand what does it means?
Please if Somebody has installed this module, tell how can I do.
Thanks in advance.   






global substitution

2002-01-07 Thread Scott

Hi all:

I have two files that I am reading into an array, I want to substitute a 
period and a dash,
actually I want to remove them completely.  Here is my code:

while (my $record = ){
my $policies = ;
my @fields = split( /\t/, $record );
my @policies = split( /\t/, $policies );

When I need a record I call it from the array @fields[5], etc.  But need do 
the removing of
.. and - before I display them.

Thanks,

-Scott


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: global substitution

2002-01-07 Thread McCollum, Frank

$record =~ s/[\.\-]//g;

if it is a '.' or a '-' replace it with nothing.
Actually, I don't even think the [] is necessary, so it could just be:
$record =~ s/\.\-//g;


-Original Message-
From: Scott [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 07, 2002 4:02 PM
To: [EMAIL PROTECTED]
Subject: global substitution


Hi all:

I have two files that I am reading into an array, I want to substitute a 
period and a dash,
actually I want to remove them completely.  Here is my code:

while (my $record = ){
my $policies = ;
my @fields = split( /\t/, $record );
my @policies = split( /\t/, $policies );

When I need a record I call it from the array @fields[5], etc.  But need do 
the removing of
... and - before I display them.

Thanks,

-Scott


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: global substitution

2002-01-07 Thread Jeff 'japhy' Pinyan

On Jan 7, McCollum, Frank said:

>$record =~ s/[\.\-]//g;

Neither of those two slashes are needed.

>if it is a '.' or a '-' replace it with nothing.
>Actually, I don't even think the [] is necessary, so it could just be:
>$record =~ s/\.\-//g;

No, the [...] is needed.  Otherwise, you're removing all occurrences of
the string ".-" which is not what was intended.

So s/[.-]+//g, or perhaps tr/.-//d;

-- 
Jeff "japhy" Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
 what does y/// stand for?   why, yansliterate of course.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: global substitution

2002-01-07 Thread Jose Vicente

I think:
foreach $value(@fields)
{
$value = s/\.\-//g;
}
- Original Message -
From: "Scott" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, January 07, 2002 4:02 PM
Subject: global substitution


> Hi all:
>
> I have two files that I am reading into an array, I want to substitute a
> period and a dash,
> actually I want to remove them completely.  Here is my code:
>
> while (my $record = ){
> my $policies = ;
> my @fields = split( /\t/, $record );
> my @policies = split( /\t/, $policies );
>
> When I need a record I call it from the array @fields[5], etc.  But need
do
> the removing of
> .. and - before I display them.
>
> Thanks,
>
> -Scott
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: global substitution

2002-01-07 Thread Scott

At 04:04 PM 1/7/2002 -0500, Jeff 'japhy' Pinyan wrote:
>No, the [...] is needed.  Otherwise, you're removing all occurrences of
>the string ".-" which is not what was intended.
>
>So s/[.-]+//g, or perhaps tr/.-//d;

I might have worded it wrong, I need to replace a period (.) and a dash 
(-), they may
not be together ie (.-), they could be in any of the fields in the 
array.  Some of the fields
are numbers (5000.00), some are dates (2002-01-07).


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: global substitution

2002-01-07 Thread McCollum, Frank

so, if a character is inside of square brackets [], then perl recognizes
that it is part of a character class and never uses it as a quantifier or
special character??

-Original Message-
From: Jeff 'japhy' Pinyan [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 07, 2002 4:04 PM
To: McCollum, Frank
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: global substitution


On Jan 7, McCollum, Frank said:

>$record =~ s/[\.\-]//g;

Neither of those two slashes are needed.

>if it is a '.' or a '-' replace it with nothing.
>Actually, I don't even think the [] is necessary, so it could just be:
>$record =~ s/\.\-//g;

No, the [...] is needed.  Otherwise, you're removing all occurrences of
the string ".-" which is not what was intended.

So s/[.-]+//g, or perhaps tr/.-//d;

-- 
Jeff "japhy" Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
 what does y/// stand for?   why, yansliterate of course.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: global substitution

2002-01-07 Thread Jeff 'japhy' Pinyan

On Jan 7, Scott said:

>At 04:04 PM 1/7/2002 -0500, Jeff 'japhy' Pinyan wrote:
>>No, the [...] is needed.  Otherwise, you're removing all occurrences of
>>the string ".-" which is not what was intended.
>>
>>So s/[.-]+//g, or perhaps tr/.-//d;
>
>I might have worded it wrong, I need to replace a period (.) and a dash
>(-), they may not be together ie (.-), they could be in any of the
>fields in the array.  Some of the fields are numbers (5000.00), some are
>dates (2002-01-07).

Right, and that was what I said, and that is what the code I have posted
does.

-- 
Jeff "japhy" Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
 what does y/// stand for?   why, yansliterate of course.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: global substitution

2002-01-07 Thread Jeff 'japhy' Pinyan

On Jan 7, McCollum, Frank said:

>so, if a character is inside of square brackets [], then perl recognizes
>that it is part of a character class and never uses it as a quantifier or
>special character??

Very few characters need escaping a char class.  ] does (unless it's the
first character of the class), ^ does (ONLY when it's the first character
of the class and you don't want it to mean "take the opposite of this char
class"), and - does (ONLY when it is between two characters that would
otherwise cause it to form a range).  Then of course $ and @ need it, but
that's so that you're not making a variable by mistake.

-- 
Jeff "japhy" Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
 what does y/// stand for?   why, yansliterate of course.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




rand() function

2002-01-07 Thread Robert Howard

Is there a statistically better solution for generating random numbers than
Perl's built in rand() function? I noticed a couple modules on CSPAN, but
are they any better? I haven't done a true test of the spread regular rand()
gives, but it seems to me to give numbers closer to the top of the range
specified more often then numbers at the bottom of the range.

R.A. Howard


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




CGI::FastTemplate confusion

2002-01-07 Thread webmaster

Hello all,

I've just begun to use CGI::FastTemplate and I get the feeling I am misunderstanding
something.  I have read the perldoc repeatedly, but I guess it's just not
sinking in.  If anyone can lend some insight, it would be much appreciated.

I have done the following:

1) Created an HTML template file which contains HTML code (of course) and
the names of variables that are populated in my script.  For example, if
the following line is in my template file:

Hello $name

Then somewhere in my perl script, you will find:

my $name = "Ian";

2) Included the following in the perl script:

CGI::FastTemplate->set_root("/where/my/templates/are");
$tpl->define( main   => "filename.tpl");
$tpl->parse( PAGE  => "main");
$tpl->print(PAGE);

I get the feeling I am misinterpreting how CGI::FastTemplate works, but
what I see is that the script does indeed print my template file, but does
not replace any of my variables at all (with strict on, I can see them in
the output quite clearly).  So I am left to wonder, did I just make a silly
mistake, or did I misinterpret how it works?  That is, I believe I am most
confused by the syntax of $tpl->parse().  Does this just tell FastTemplate
to parse the template file and replace the variables with those in the script,
or do I have to actually define a separate variable for each one I want
FastTemplate to replace?  In the code above, I picked "PAGE" as an arbitrary
name representing my template with all variables replaced.  Should this
instead be the name of a variable in itself that I want parsed in the template,
meaning I need to call $tpl->parse() for each and every one of my variables?

I hope I have been clear.  Again, any insight into my confusion is appreciated.

-Ian




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: CGI::FastTemplate confusion

2002-01-07 Thread Peter Cline

At 04:36 PM 1/7/02 -0500, you wrote:
>Hello all,
>
>I've just begun to use CGI::FastTemplate and I get the feeling I am 
>misunderstanding
>something.  I have read the perldoc repeatedly, but I guess it's just not
>sinking in.  If anyone can lend some insight, it would be much appreciated.
>
>I have done the following:
>
>1) Created an HTML template file which contains HTML code (of course) and
>the names of variables that are populated in my script.  For example, if
>the following line is in my template file:
>
>Hello $name
>
>Then somewhere in my perl script, you will find:
>
>my $name = "Ian";
>
>2) Included the following in the perl script:
>
>CGI::FastTemplate->set_root("/where/my/templates/are");
>$tpl->define( main   => "filename.tpl");
>$tpl->parse( PAGE  => "main");
>$tpl->print(PAGE);
>
>I get the feeling I am misinterpreting how CGI::FastTemplate works, but
>what I see is that the script does indeed print my template file, but does
>not replace any of my variables at all (with strict on, I can see them in
>the output quite clearly).  So I am left to wonder, did I just make a silly
>mistake, or did I misinterpret how it works?  That is, I believe I am most
>confused by the syntax of $tpl->parse().  Does this just tell FastTemplate
>to parse the template file and replace the variables with those in the script,
>or do I have to actually define a separate variable for each one I want
>FastTemplate to replace?  In the code above, I picked "PAGE" as an arbitrary
>name representing my template with all variables replaced.  Should this
>instead be the name of a variable in itself that I want parsed in the 
>template,
>meaning I need to call $tpl->parse() for each and every one of my variables?
>
>I hope I have been clear.  Again, any insight into my confusion is 
>appreciated.
>
>-Ian

>This probably should be addressed to [EMAIL PROTECTED], but since I 
>think I can help, here goes.

You need to use the assign method before the parse.  tpl->assign($hashref)
This method expects a hasref as an argument.  Put all your variables in 
this hash ref and then pass it to assign.  Also, I think the variable names 
must be all caps.

HTH





Peter Cline
Inet Developer
New York Times Digital


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: CGI::FastTemplate confusion

2002-01-07 Thread Jeff 'japhy' Pinyan

On Jan 7, [EMAIL PROTECTED] said:

>1) Created an HTML template file which contains HTML code (of course) and
>the names of variables that are populated in my script.  For example, if
>the following line is in my template file:
>
>Hello $name
>
>Then somewhere in my perl script, you will find:
>
>my $name = "Ian";

The variable in your template file must be uppercase, so it must be $NAME.
The variable in your program can be named whatever you want -- the
connection will be seen in a moment.

>2) Included the following in the perl script:
>
>CGI::FastTemplate->set_root("/where/my/templates/are");
>$tpl->define( main   => "filename.tpl");

Add here:

  $tpl->assign(NAME => $name);

That will cause "$NAME" to be replaced with $name's value in your
template.

>$tpl->parse( PAGE  => "main");
>$tpl->print(PAGE);

-- 
Jeff "japhy" Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
 what does y/// stand for?   why, yansliterate of course.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: CGI::FastTemplate confusion

2002-01-07 Thread webmaster

Hello Peter et al,

>>This probably should be addressed to [EMAIL PROTECTED], but since
I
>>think I can help, here goes.

Sorry about that; I thought about it only after hitting send.


>You need to use the assign method before the parse.  tpl->assign($hashref)
>This method expects a hasref as an argument.  Put all your variables in

>this hash ref and then pass it to assign.  Also, I think the variable names
> must be all caps.

Thanks much - this worked.  I knew I was making it too simple.  And for
reference, it doesn't restrict variable names to all caps.

-Ian




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: rand() function

2002-01-07 Thread McCollum, Frank


I did a random sampling of 10,000 random numbers in two separate groups :

for (0..1) { print rand()."\n" }


It seemed to consistently revert towards a mean of 0.50 (i.e. results(1) =
0.503; results(2) = 0.498).  I also broke those into groups of 100 and
seemed to get the same results.  That makes me think that any results that
seemed to favor higher numbers was probably random.

-Original Message-
From: Robert Howard [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 07, 2002 4:31 PM
To: [EMAIL PROTECTED]
Subject: rand() function


Is there a statistically better solution for generating random numbers than
Perl's built in rand() function? I noticed a couple modules on CSPAN, but
are they any better? I haven't done a true test of the spread regular rand()
gives, but it seems to me to give numbers closer to the top of the range
specified more often then numbers at the bottom of the range.

R.A. Howard


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: global substitution

2002-01-07 Thread Scott

At 04:12 PM 1/7/2002 -0500, Jeff 'japhy' Pinyan wrote:
> >>So s/[.-]+//g, or perhaps tr/.-//d;
> >I might have worded it wrong, I need to replace a period (.) and a dash
> >(-), they may not be together ie (.-), they could be in any of the
> >fields in the array.  Some of the fields are numbers (5000.00), some are
> >dates (2002-01-07).
>
>Right, and that was what I said, and that is what the code I have posted
>does.

Thank you Jeff.  Works like a charm.  One other thing I need to filter out 
is [:]'s
in a time display 00:00:00.  When I added it to the s/[.-]+//g statement it 
replaced
them with double dashes?

-Scott


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: global substitution

2002-01-07 Thread Jeff 'japhy' Pinyan

On Jan 7, Scott said:

>At 04:12 PM 1/7/2002 -0500, Jeff 'japhy' Pinyan wrote:
>> >>So s/[.-]+//g, or perhaps tr/.-//d;
>> >I might have worded it wrong, I need to replace a period (.) and a dash
>> >(-), they may not be together ie (.-), they could be in any of the
>> >fields in the array.  Some of the fields are numbers (5000.00), some are
>> >dates (2002-01-07).
>>
>>Right, and that was what I said, and that is what the code I have posted
>>does.
>
>Thank you Jeff.  Works like a charm.  One other thing I need to filter
>out is [:]'s in a time display 00:00:00.  When I added it to the
>s/[.-]+//g statement it replaced them with double dashes?

Hrm?  I'm not sure I know what you mean -- how could it have replaced them
with anything unless you put something on the right-hand side of the s///?

Anyway, you want s/[.:-]+//g, or something to that effect.  Be warned,
though, that [.-:] is NOT what you want, since that means "characters from
'.' to '-'", which is the following list:

  . / 0 1 2 3 4 5 6 7 8 9 :

-- 
Jeff "japhy" Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
 what does y/// stand for?   why, yansliterate of course.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: who is the method cop?

2002-01-07 Thread Skip Montanaro


Jonathan> To make this clear, in Perl OOP you use:

Jonathan> Packages as classes.
Jonathan> Subroutines as instance methods/class methods.
Jonathan> Package variables for class variables. 
Jonathan> Blessed variables for object instances.

Thanks, this is the correspondence I was missing.

-- 
Skip Montanaro ([EMAIL PROTECTED] - http://www.mojam.com/)

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




A tk question

2002-01-07 Thread Murzc


I have a TK issue.

This code creates the initial TK box.

>>  use vars qw/$TOP/;

>>  $TOP = Tk::MainWindow->new;

>>  $TOP->title('blah blah');
>>  $TOP->configure(-background => lc('PeachPuff1'));
etc.(a lot more code)

When the user clicks the button of his choice, the TK box disappears into the task bar.
When the user clicks the task bar on the program's name,
a window of a DOS screen pops up and asks the user 
"Enter Perl Script to execute."

The code is below. 


>>  $TOP->iconify;
>>  $TOP->withdraw;

>>  print "\nEnter Perl Script to execute: ";

>>  $pgm = ;
>>  chomp($pgm);

etc.


The question we are having.
Why do it in 2 steps. 1: Click the TK button.  2: Clikc the Task bar.
Why not do it one step if possible?
Can the Dos screen pop up right away after the button is clicked?   

If you need more of the code let me know.

Thank you.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: global substitution

2002-01-07 Thread Scott

At 05:01 PM 1/7/2002 -0500, Jeff 'japhy' Pinyan wrote:
>Anyway, you want s/[.:-]+//g, or something to that effect.  Be warned,
>though, that [.-:] is NOT what you want, since that means "characters from
>'.' to '-'", which is the following list:
>   . / 0 1 2 3 4 5 6 7 8 9 :

And that was my newbie mistake.  Thank you!

-Scott


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: rand() function

2002-01-07 Thread John W. Krahn

Robert Howard wrote:
> 
> Is there a statistically better solution for generating random numbers than
> Perl's built in rand() function? I noticed a couple modules on CSPAN, but
> are they any better? I haven't done a true test of the spread regular rand()
> gives, but it seems to me to give numbers closer to the top of the range
> specified more often then numbers at the bottom of the range.

http://random.org


John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: date compare problems

2002-01-07 Thread John W. Krahn

"John W. Krahn" wrote:
> 
> #!/usr/bin/perl -w
> use strict;
> 
> # Get the mtime from two files
> my $date1 = (stat $file)[9];
> my $date2 = (stat 'zzp2.txt')[9];
> 
> print scalar $date1, '   ', scalar $date2, "\n";

Sorry, I was typing too fast.  This line should be:

print scalar localtime($date1), '   ', scalar localtime($date2), "\n";


> if ( $date1 < $date2 ) {
> print "$file is older than zzp2.txt.\n";
> }
> elsif ( $date2 < $date1 ) {
> print "zzp2.txt is older than $file.\n";
> }
> else {
> print "the two dates are identical.\n";
> }
> 
> __END__



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: CGI perl html urgent

2002-01-07 Thread Bud Rogers

Prahlad Vaidyanathan wrote:

> Does emacs do syntax highlighting ? I've been using Vim for a very
> long time now, but last time I checked Emacs didn't do it.

Xemacs does.  IMO not as good as Vim, but very good nonetheless.  It's 
been a very long time since I used Emacs, but I'm pretty sure it does 
also.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




how to change directory in AIX in Perl ?

2002-01-07 Thread Families Laws

I tried to do a change directory and then do a tar of
the directory:

My program:

  system("cd /usr/apps");
  system("tar -cf tarfile.tar DDA/*");

It looks like the cd command does not work ?

Thanks in advance. 

__
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: how to change directory in AIX in Perl ?

2002-01-07 Thread Jeff 'japhy' Pinyan

On Jan 7, Families Laws said:

>I tried to do a change directory and then do a tar of
>the directory:

Use the chdir() function.

>  system("cd /usr/apps");

That creates a new shell, exectes 'cd /usr/apps', and then closes the
shell.  End result:  you've moved nowhere.

-- 
Jeff "japhy" Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
 what does y/// stand for?   why, yansliterate of course.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Password ---- cgi-perl-html

2002-01-07 Thread Luinrandir Hernson

I am trying to password protect part of my website.
I have the password  page done. 
But how to I make the pages protected so you have to go through the password page?
Do i do it by passing hidden inputs from page to page?
How do I force people coming in around the password page to go through the password 
page?

Any hints? Oh and I know nothing about perl moduals... 

cheers - thanks!

Lou H.



  1   2   >