[18081] in Perl-Users-Digest
Perl-Users Digest, Issue: 241 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Feb 8 09:05:46 2001
Date: Thu, 8 Feb 2001 06:05:17 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <981641117-v10-i241@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 8 Feb 2001 Volume: 10 Number: 241
Today's topics:
Re: about dying <emelin@my-deja.com>
alt.perl and correctness (was Re: hex to binary convers (Randal L. Schwartz)
Re: alt.perl and correctness (was Re: hex to binary con (Abigail)
Re: alt.perl and correctness (was Re: hex to binary con (Randal L. Schwartz)
Re: Date Suffix Routine - 1st, 2nd, 3rd... (Joe Smith)
Re: Date Suffix Routine - 1st, 2nd, 3rd... <jonni@ifm.liu.se>
Re: Date Suffix Routine - 1st, 2nd, 3rd... <jonni@ifm.liu.se>
Re: Date Suffix Routine - 1st, 2nd, 3rd... <jonni@ifm.liu.se>
Re: don't want to let them enter & and = ... <emelin@my-deja.com>
Re: don't want to let them enter & and = ... (Randal L. Schwartz)
Re: don't want to let them enter & and = ... <emelin@my-deja.com>
Re: don't want to let them enter & and = ... gnari@my-deja.com
Re: Fastest way of left-padding a number? (Martien Verbruggen)
Re: Fastest way of left-padding a number? (Martien Verbruggen)
Re: hex to binary conversion ? Please help (Peter J. Acklam)
How to get data from HTML to PERL? jedialf@my-deja.com
Re: How to get data from HTML to PERL? <singhd@lucent.com>
Re: how to remove item in the array? <qvyht@iobox.fi>
Learning Perl carryg@my-deja.com
Re: Learning Perl (Jon Bell)
Mailtools-1.15 confusing to me. pointers, please? <nospam@nospam.com>
Re: Need Help Checking IP Address Syntax w/ PERL? (Joe Smith)
Re: Need Help Checking IP Address Syntax w/ PERL? (Joe Smith)
Re: Need Help Checking IP Address Syntax w/ PERL? (Joe Smith)
Re: Need Help Checking IP Address Syntax w/ PERL? (Peter J. Acklam)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 08 Feb 2001 08:37:17 GMT
From: emelin <emelin@my-deja.com>
Subject: Re: about dying
Message-Id: <95tlrt$7f1$1@nnrp1.deja.com>
> man CGI::Carp
>
> if you
>
> use CGI::Carp qw/ fatalsToBrowser / ;
>
> I believe this will get you what you are after....
Okay, so I did this...
This prints out lots of stuff...
How do I print out ONLY my own error message, not all that junk from
the server? (I know how to change the "contact webmaster for help" etc,
but I want to get rid of EVERYTHING, including the info on where the
script died)...
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: 08 Feb 2001 04:22:43 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: alt.perl and correctness (was Re: hex to binary conversion ? Please help)
Message-Id: <m1vgqlqs8c.fsf_-_@halfdome.holdit.com>
>>>>> "Peter" == Peter J Acklam <jacklam@math.uio.no> writes:
Peter> True, and that is a problem. On the other hand, alt.perl doesn't
Peter> have the endless insults and horassments that you find here.
I wonder how come people keep saying this.
In CLPM, I see a *ton* of good questions and answers go by. And at
that volume, there also happen to be quite a few *bad* questions that
show up, and then the ensuing "RTFM" or "that's offtopic" posts that
rightfully follow.
If you call that an "insult" or "harassment", then fine, but it's not
the ratios that are different, it's the volume. alt.perl has less
"RTFM" or "offtopic" responses because there are fewer questions that
are right out of the FAQ or offtopic to start with.
alt.perl feels more like CLPM when CLPM had only 50 posts a day. But
the tolerance for offtopic or laziness seems to be precisely the same.
That's why alt.perl is a bizarre anomaly to me. It was created after
the CLP.m* groups were firmly established, for purposes I'm not
completely clear. And yet, initially, it served as a low-grade help
desk, with a lot of cargo-cult passed around.
Then some of us with larger clue bases (and huge desires to help)
noticed it, and have moved in to help, so the quality is now higher,
but we've had to keep putting in our share of "this is offtopic" or
"please RTFM" to avoid alt.perl from just being a stream of repeated
answers that are (sometimes incorrectly) cribbed from some larger
publication.
And then we get the other problems... the 'separate-post-ists' who
copy a posting from clpm to alt.perl (or vice versa) and then get two
entirely different sets of people working on the same (usually
trivial) issue. (Like this hex2bin thing further up this thread.)
And that's annoying, and a waste of the cluefuls time.
I'd rather alt.perl go away. But since it's here... I guess it'll be
in my subscribe list.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL: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!
------------------------------
Date: 8 Feb 2001 13:00:03 GMT
From: abigail@foad.org (Abigail)
Subject: Re: alt.perl and correctness (was Re: hex to binary conversion ? Please help)
Message-Id: <slrn98562j.f7l.abigail@tsathoggua.rlyeh.net>
Randal L. Schwartz (merlyn@stonehenge.com) wrote on MMDCCXVIII September
MCMXCIII in <URL:news:m1vgqlqs8c.fsf_-_@halfdome.holdit.com>:
()
() I'd rather alt.perl go away. But since it's here... I guess it'll be
() in my subscribe list.
Then you are actively keeping it alive. After all, if lots of people
answer questions in both groups, there's no initiative to move to
clp.misc.
My contribution of getting rid of alt.perl is not subscribing to it,
and to killfile anything crossposted to it. (But that might for some
people be just the reason to post in alt.perl...)
Abigail
--
print 74.117.115.116.32, 97.110.111.116.104.101.114.32,
80.101.114.108.32, 72.97.99.107.101.114.10;
------------------------------
Date: 08 Feb 2001 05:18:43 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: alt.perl and correctness (was Re: hex to binary conversion ? Please help)
Message-Id: <m1lmrhpb2k.fsf@halfdome.holdit.com>
>>>>> "Abigail" == Abigail <abigail@foad.org> writes:
Abigail> Randal L. Schwartz (merlyn@stonehenge.com) wrote on MMDCCXVIII September
Abigail> MCMXCIII in <URL:news:m1vgqlqs8c.fsf_-_@halfdome.holdit.com>:
Abigail> ()
Abigail> () I'd rather alt.perl go away. But since it's here... I guess it'll be
Abigail> () in my subscribe list.
Abigail> Then you are actively keeping it alive. After all, if lots of people
Abigail> answer questions in both groups, there's no initiative to move to
Abigail> clp.misc.
No, call it karma, but if I let questions get answered badly there,
it'll be just my luck that one of those incorrect answers will be used
to make a crap website somewhere that leaks my credit card number or
keeps me from finding out about a good deal or something.
Bad virus memes must die. I am the ... (da duh!) Innoculator!
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL: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!
------------------------------
Date: 8 Feb 2001 11:51:43 GMT
From: inwap@best.com (Joe Smith)
Subject: Re: Date Suffix Routine - 1st, 2nd, 3rd...
Message-Id: <95u18g$2dfn$1@nntp1.ba.best.com>
In article <95tdia$8cp$1@newsy.ifm.liu.se>,
Jonas Nilsson <jonni@ifm.liu.se> wrote:
>sub suffix {
> ($_[0]%100>4 and $_[0]%100<21)?'':('','st','nd','rd')[$_[0]%10] or 'th';
>}
I'd say that
($_[0]%100>10 and $_[0]%100<14)?'th':('','st','nd','rd')[$_[0]%10] or 'th';
is easier to understand. But your way is 3 characters shorter. Golf!
-Joe
--
See http://www.inwap.com/ for PDP-10 and "ReBoot" pages.
------------------------------
Date: Thu, 8 Feb 2001 13:22:20 +0100
From: "Jonas Nilsson" <jonni@ifm.liu.se>
Subject: Re: Date Suffix Routine - 1st, 2nd, 3rd...
Message-Id: <95u30p$sgk$1@newsy.ifm.liu.se>
If you want something short try:
qw(th th)[$_[0]%100-12]?0:qw(0 st nd rd)[$_[0]%10]or'th';
Can anyone make it shorter?
/jN
--
_____________________ _____________________
| Jonas Nilsson | | |
|Linkoping University | | Telephone |
| IFM | | --------- |
| Dept. of Chemistry | | work: +46-13-285690 |
| 581 83 Linkoping | | fax: +46-13-281399 |
| Sweden | | home: +46-13-130294 |
|_____________________| |_____________________|
"Joe Smith" <inwap@best.com> wrote in message
news:95u18g$2dfn$1@nntp1.ba.best.com...
> In article <95tdia$8cp$1@newsy.ifm.liu.se>,
> Jonas Nilsson <jonni@ifm.liu.se> wrote:
> >sub suffix {
> > ($_[0]%100>4 and $_[0]%100<21)?'':('','st','nd','rd')[$_[0]%10] or 'th';
> >}
>
> I'd say that
> ($_[0]%100>10 and $_[0]%100<14)?'th':('','st','nd','rd')[$_[0]%10] or
'th';
> is easier to understand. But your way is 3 characters shorter. Golf!
> -Joe
>
> --
> See http://www.inwap.com/ for PDP-10 and "ReBoot" pages.
------------------------------
Date: Thu, 8 Feb 2001 13:30:18 +0100
From: "Jonas Nilsson" <jonni@ifm.liu.se>
Subject: Re: Date Suffix Routine - 1st, 2nd, 3rd...
Message-Id: <95u3fm$sgr$1@newsy.ifm.liu.se>
Or this...
abs($_[0]%100-12)<2?0:qw(0 st nd rd)[$_[0]%10]or'th';
--
_____________________ _____________________
| Jonas Nilsson | | |
|Linkoping University | | Telephone |
| IFM | | --------- |
| Dept. of Chemistry | | work: +46-13-285690 |
| 581 83 Linkoping | | fax: +46-13-281399 |
| Sweden | | home: +46-13-130294 |
|_____________________| |_____________________|
"Jonas Nilsson" <jonni@ifm.liu.se> wrote in message
news:95u30p$sgk$1@newsy.ifm.liu.se...
> If you want something short try:
> qw(th th)[$_[0]%100-12]?0:qw(0 st nd rd)[$_[0]%10]or'th';
>
> Can anyone make it shorter?
> /jN
> "Joe Smith" <inwap@best.com> wrote in message
> news:95u18g$2dfn$1@nntp1.ba.best.com...
> > In article <95tdia$8cp$1@newsy.ifm.liu.se>,
> > Jonas Nilsson <jonni@ifm.liu.se> wrote:
> > >sub suffix {
> > > ($_[0]%100>4 and $_[0]%100<21)?'':('','st','nd','rd')[$_[0]%10] or
'th';
> > >}
> >
> > I'd say that
> > ($_[0]%100>10 and $_[0]%100<14)?'th':('','st','nd','rd')[$_[0]%10] or
> 'th';
> > is easier to understand. But your way is 3 characters shorter. Golf!
> > -Joe
------------------------------
Date: Thu, 8 Feb 2001 13:35:20 +0100
From: "Jonas Nilsson" <jonni@ifm.liu.se>
Subject: Re: Date Suffix Routine - 1st, 2nd, 3rd...
Message-Id: <95u3p2$sl2$1@newsy.ifm.liu.se>
Or this...
$_[0]=~/1\d$/?0:qw(0 st nd rd)[$_[0]%10]or'th';
/jN
--
_____________________ _____________________
| Jonas Nilsson | | |
|Linkoping University | | Telephone |
| IFM | | --------- |
| Dept. of Chemistry | | work: +46-13-285690 |
| 581 83 Linkoping | | fax: +46-13-281399 |
| Sweden | | home: +46-13-130294 |
|_____________________| |_____________________|
"Jonas Nilsson" <jonni@ifm.liu.se> wrote in message
news:95u3fm$sgr$1@newsy.ifm.liu.se...
> Or this...
> abs($_[0]%100-12)<2?0:qw(0 st nd rd)[$_[0]%10]or'th';
>
> --
> _____________________ _____________________
> | Jonas Nilsson | | |
> |Linkoping University | | Telephone |
> | IFM | | --------- |
> | Dept. of Chemistry | | work: +46-13-285690 |
> | 581 83 Linkoping | | fax: +46-13-281399 |
> | Sweden | | home: +46-13-130294 |
> |_____________________| |_____________________|
> "Jonas Nilsson" <jonni@ifm.liu.se> wrote in message
> news:95u30p$sgk$1@newsy.ifm.liu.se...
> > If you want something short try:
> > qw(th th)[$_[0]%100-12]?0:qw(0 st nd rd)[$_[0]%10]or'th';
> >
> > Can anyone make it shorter?
> > /jN
>
>
> > "Joe Smith" <inwap@best.com> wrote in message
> > news:95u18g$2dfn$1@nntp1.ba.best.com...
> > > In article <95tdia$8cp$1@newsy.ifm.liu.se>,
> > > Jonas Nilsson <jonni@ifm.liu.se> wrote:
> > > >sub suffix {
> > > > ($_[0]%100>4 and $_[0]%100<21)?'':('','st','nd','rd')[$_[0]%10] or
> 'th';
> > > >}
> > >
> > > I'd say that
> > > ($_[0]%100>10 and $_[0]%100<14)?'th':('','st','nd','rd')[$_[0]%10] or
> > 'th';
> > > is easier to understand. But your way is 3 characters shorter.
Golf!
> > > -Joe
>
>
>
------------------------------
Date: Thu, 08 Feb 2001 10:12:49 GMT
From: emelin <emelin@my-deja.com>
Subject: Re: don't want to let them enter & and = ...
Message-Id: <95treu$bai$1@nnrp1.deja.com>
> Stop using "this code". Replace it with:
>
> use CGI qw(import_names);
> import_names('FORM');
Okay, so I am now using this... but it does the same thing!
The user can still input "&" and screw up the whole thing...
How do I display an error message and let them go back and change??
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: 08 Feb 2001 04:23:58 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: don't want to let them enter & and = ...
Message-Id: <m1r919qs69.fsf@halfdome.holdit.com>
>>>>> "emelin" == emelin <emelin@my-deja.com> writes:
>> Stop using "this code". Replace it with:
>>
>> use CGI qw(import_names);
>> import_names('FORM');
emelin> Okay, so I am now using this... but it does the same thing!
emelin> The user can still input "&" and screw up the whole thing...
Please show me an example of "screw up the whole thing".
If the user inputs a &, it'll be in your data as "&". What are you
doing with that data to "screw [it] up"? It's your problem at this
point.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL: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!
------------------------------
Date: Thu, 08 Feb 2001 13:08:52 GMT
From: emelin <emelin@my-deja.com>
Subject: Re: don't want to let them enter & and = ...
Message-Id: <95u5p0$ivq$1@nnrp1.deja.com>
> >> Stop using "this code". Replace it with:
> >>
> >> use CGI qw(import_names);
> >> import_names('FORM');
>
> emelin> Okay, so I am now using this... but it does the same thing!
> emelin> The user can still input "&" and screw up the whole thing...
>
> Please show me an example of "screw up the whole thing".
>
> If the user inputs a &, it'll be in your data as "&". What are you
> doing with that data to "screw [it] up"? It's your problem at this
> point.
Well... after fetching the form input I'm writing it to a file,
with "&" as separator between entries... and then when I read it from
the file and split with &, obviously things get messy.
Should I do this another way?
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Thu, 08 Feb 2001 13:36:08 GMT
From: gnari@my-deja.com
Subject: Re: don't want to let them enter & and = ...
Message-Id: <95u7c7$k6a$1@nnrp1.deja.com>
In article <95u5p0$ivq$1@nnrp1.deja.com>,
emelin <emelin@my-deja.com> wrote:
>
> > >> Stop using "this code". Replace it with:
> > >>
> > >> use CGI qw(import_names);
> > >> import_names('FORM');
> >
> > emelin> Okay, so I am now using this... but it does the same thing!
> > emelin> The user can still input "&" and screw up the whole thing...
> >
> > Please show me an example of "screw up the whole thing".
> >
> > If the user inputs a &, it'll be in your data as "&". What are you
> > doing with that data to "screw [it] up"? It's your problem at this
> > point.
>
> Well... after fetching the form input I'm writing it to a file,
> with "&" as separator between entries... and then when I read it from
> the file and split with &, obviously things get messy.
>
> Should I do this another way?
>
ok
actually your original code was ok except it is silly not to use CGI
unless you have particular reasons.
it is very common for people to get into problems when they try to
reinvent CGI, and that is why you got automatic responses to use CGI.
your real problem is that you want to store userinput in a file
delimited by a character that may exist in the input, in this case '&'.
a few solutions come to mind:
a) use a different delimiter. for example the TAB character or
some other that is impossible to be offered as input
b) test for the existence of the character, and return an error if found
c) encode the input in some way before storing. there are many ways
to do this, but if you are going to use CGI anyways, why not let it
do it for you. I think the relevant functions are CGI::escape() and
CGI::unescape()
Good luck
gnari
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Thu, 8 Feb 2001 21:36:58 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Fastest way of left-padding a number?
Message-Id: <slrn984tma.vht.mgjv@martien.heliotrope.home>
On Wed, 7 Feb 2001 12:25:25 +0100,
Jonas Nilsson <jonni@ifm.liu.se> wrote:
> I found a way that is faster on my platform (WinNT).
Not significantly. The three fastest ones are more or less equivalent.
unless you see a 50% or so difference in benchmarks, you shouldn't draw
conclusions about which method is faster. A deviation of a few percent
doesn't mean a thing. Rerunning the same tests probably shows them in a
different order. Even a difference of 20% should be taken a little
lightly, because other effects might come in play.
And you should probably also run
test7 => '$f = $val'
Just to compare what part of your time is spent in simply assigning and
reading variables.
Beware of drawing conclusions from benchmarks, unless there is a
significant difference.
Martien
--
Martien Verbruggen |
Interactive Media Division | If at first you don't succeed, try
Commercial Dynamics Pty. Ltd. | again. Then quit; there's no use
NSW, Australia | being a damn fool about it.
------------------------------
Date: Thu, 8 Feb 2001 21:45:24 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Fastest way of left-padding a number?
Message-Id: <slrn984u64.vht.mgjv@martien.heliotrope.home>
On Wed, 7 Feb 2001 12:25:25 +0100,
Jonas Nilsson <jonni@ifm.liu.se> wrote:
> I found a way that is faster on my platform (WinNT).
Oh, another interesting nicety that shows up when you play a bit more
with this stuff is the difference in evalling strings and executing subs
in Benchmarks.
Compare yours:
> 'test5',
> '$e=substr("0000".$val,-4,4)',
to something like:
test5a => sub { $e = substr("0000".$val,-4,4) },
just for giggles. Pay special attention to the ratio of each of the
combination of tests. You'll note that in some cases the string version
is faster, and in others the sub version. it becomes even harder now to
draw conclusions, in the absence of really clear differences. Apart from
that, the platform you're on, The CPU installed, the backplane and
memory, and ther compiler used to compile Perl, as well as the
underlying system libraries, all have an influence on which bit is
faster[1].
Martien
[1] Yes, I know you qualified which platform you're on, but not which
Perl, how it was compiled, what sort of CPU, etc. All of that is of
influence.
--
Martien Verbruggen | The Second Law of Thermodenial: In
Interactive Media Division | any closed mind the quantity of
Commercial Dynamics Pty. Ltd. | ignorance remains constant or
NSW, Australia | increases.
------------------------------
Date: 08 Feb 2001 11:36:18 +0100
From: jacklam@math.uio.no (Peter J. Acklam)
Subject: Re: hex to binary conversion ? Please help
Message-Id: <wkelx9scbo.fsf@math.uio.no>
merlyn@stonehenge.com (Randal L. Schwartz) writes:
> >>>>> "Michael" == Michael Carman <mjcarman@home.com> writes:
>
> Michael> Why's Randal over in alt.perl anyway? Is he doing
> Michael> penance?
>
> There's a lot more "blind leading the blind" there than in the
> real groups.
True, and that is a problem. On the other hand, alt.perl doesn't
have the endless insults and horassments that you find here.
Peter
--
sub int2roman{@x=split//,sprintf'%04d',shift;@r=('','I','V','X','L','C','D'
,'M');@p=([],[1],[1,1],[1,1,1],[1,2],[2],[2,1],[2,1,1],[2,1,1,1],[1,3],[3])
;join'',@r[map($_+6,@{$p[$x[0]]}),map($_+4,@{$p[$x[1]]}),map($_+2,@{$p[$x[2
]]}),map($_+0,@{$p[$x[3]]})];}print "@{[map{int2roman($_)}@ARGV]}\n";#JAPH!
------------------------------
Date: Thu, 08 Feb 2001 08:49:57 GMT
From: jedialf@my-deja.com
Subject: How to get data from HTML to PERL?
Message-Id: <95tmjk$7t6$1@nnrp1.deja.com>
Normally, perl program will have HTML codes embedded.
BUT I do not want to have HTML codes in PERL program...which means the
PERL program has to read data from HTML file.
Example in PERL file:
.....#codes are embedded here
open(UPDATE,"<../perl.htm");
while(my $line = <UPDATE>){
$line=~ s/t_value/$tableid/;
$line=~ s/u_value/$::input{'u'}/;
$line=~ s/g_value/$::input{'g'}/;
print "$line\n";
}
..... #codes are embedded here
This allows PERL file to read HTML file and replaces the value with $
values for processing. This would read the file, line by line.
Reason for this: It would allow me to amend HTML files easily without
meddling PERL codes.
I am not sure how to get a desired section from HTML file for
processing, especially a form handling. (Using data from SQL database).
Sample of HTML codes.
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-
1252" Pragma:no-cache>
<title>description</title>
</head>
<SCRIPT SRC="dbadmin.js" LANGUAGE="JavaScript">
</script>
<UPDATETABLE>
<form method="POST" action="plmgss_dbadmin.x">
<input type="hidden" name="f" value="f_value">
<input type="hidden" name="t" value="t_value">
<input type="hidden" name="u" value="u_value">
<input type="hidden" name="g" value="g_value">
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="29%" colspan="2"><i><font color="#800000" face="Impact"
size="6" >description</font></i></td>
</tr>
<tr>
<td width="2%"> </td>
</tr>
</table>
</UPDATETABLE>
<PERLBODY>
<table border="1" cellspacing="0" cellpadding="0">
<td width='10%'><p align='center'><font color='#800000' face='Arial'
size='2'>INDEX</font></p></td>
<td>
<input type="text" name="countname" value="field" size=60 style="font-
family: Arial; color: #800000 font-weight: bold">
</td>
</table>
<input type=hidden name=spanid value=Rowcount>
<input type=hidden name=colcount value=Colcount>
<span id=SpanID>
</span>
<table>
<tr><td></td></tr>
</table>
<input type="Submit" name="Submit" value="Save"><input type="button"
name="NewRow" value="New Entry" onclick="anotherrow()"><input
type="button" name="Back" value="Back" onclick="javascript:history.back
()"> </form>
</form>
</PERLBODY>
</body>
I have incorporate <UPDATETABLE> and <PERLBODY> to indicate different
section.
I would appreciate to have a simple source code similiar to this. Thank
you.
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Thu, 08 Feb 2001 10:03:00 +0000
From: Daywan Singh <singhd@lucent.com>
Subject: Re: How to get data from HTML to PERL?
Message-Id: <3A826ED4.C181B295@lucent.com>
jedialf@my-deja.com wrote:
>
> Normally, perl program will have HTML codes embedded.
>
> BUT I do not want to have HTML codes in PERL program...which means the
> PERL program has to read data from HTML file.
>
> I would appreciate to have a simple source code similiar to this. Thank
> you.
>
> Sent via Deja.com
> http://www.deja.com/
Create an HTML template file separately from the Perl program. In this file,
surround the data variables with '%%', e.g.
<H1>Report for %%username%%</H1>
Then use a Perl subroutine to read in this file and fill-in the values via hash
variable accordingly, see Perl Cookbook sec 20.9 "Creating HTML Templates".
Otherwise, you might want to investigate CPAN module Text:Template.
D Singh
------------------------------
Date: Thu, 08 Feb 2001 09:37:46 GMT
From: Hessu <qvyht@iobox.fi>
Subject: Re: how to remove item in the array?
Message-Id: <3A8268E9.3AB36467@iobox.fi>
Shawn Jamison wrote:
>
> Use splice. It's fast and easy.
> All you need is an offset to the element you want to blitz/replace
>
> This deletes the first two elements in an array. No searching no
> grepping.
> splice(@array, 0, 2)
>
> You can also add a list to grab replacement from.
> splice(@array, 0, 2, @replacements)
> The first two elements of @replacements will be subsituted for the
> first to of @array.
>
> Have fun.
>
> ]On Wed, 07 Feb 2001 15:52:31 GMT, tanase_costin@my-deja.com wrote:
>
> >In article <3A813020.A88EB902@iobox.fi>,
> > Hessu <qvyht@iobox.fi> wrote:
> >> problem is that checking trough whole array sucks all power
> >> and it's too slow way to do it anyway.
> >> can i do it with splice and how does this would work.
> >>
> >> br,
> >> lerning perl
> >>
> >
> >@newarray = grep { TESTBLOCK } @oldarray;
> >
> >
> >Sent via Deja.com
> >http://www.deja.com/
This was exatly I was needing.
Thank you!
------------------------------
Date: Thu, 08 Feb 2001 10:16:14 GMT
From: carryg@my-deja.com
Subject: Learning Perl
Message-Id: <95trlb$bdb$1@nnrp1.deja.com>
Can someone advise me, where can I learn Perl on the web? I have
never used it before, but due to my work commitments, I feel I need to
know how to use it. Many thanks Caroline
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Thu, 8 Feb 2001 12:54:34 GMT
From: jtbell@presby.edu (Jon Bell)
Subject: Re: Learning Perl
Message-Id: <G8Fvuy.FoC@presby.edu>
In article <95trlb$bdb$1@nnrp1.deja.com>, <carryg@my-deja.com> wrote:
>Can someone advise me, where can I learn Perl on the web?
Start browsing at <http://www.perl.com/>. You'll find lots of links
there.
--
Jon Bell <jtbell@presby.edu> Presbyterian College
Dept. of Physics and Computer Science Clinton, South Carolina USA
------------------------------
Date: 8 Feb 2001 09:14:47 GMT
From: The WebDragon <nospam@nospam.com>
Subject: Mailtools-1.15 confusing to me. pointers, please?
Message-Id: <95to27$d34$0@216.155.32.222>
I downloaded MailTools-1.15 on the recommendaton of someone here
(thanks!) and it looks like it'll be what I need to do the following:
I'm working on a simple submission perl/cgi program to enable users to
enter a 'review request' .. the script will subsequently do these
things:
o Enter the info in a database that will be viewable with another
script so that a reviewer can 'claim' the review and queue it in his/her
own to-do list, and provide a list of 'what's next, and what's already
been done' to all reviewers.
o It will also look up in the database to see whether such a request
has already been submitted for that map, and notify the user in that
case.
o It will then proceed to e-mail our internal mailing list notifying
us of the 'review request'. (and it's this part I'm stumbling at)
I had planned to use a simple Net::SMTP script I had lying around from
the examples, but it seems to produce non-compliant RFC822 headers (at
which post regarding, I recieved mention of Mailtools..)
Downloaded that, and browsed the multitudinous .pod docs for all of them
without really finding a 'tie-it-all-together' sort of business in one
place with some more concrete examples of 'how it should/could be done'
does anyone have a simple example or two that use the MailTools
module(s) to do a simple SMTP type mailing that I can adapt to the
following criteria on my own:
TO a known address
FROM a known address
with a known SUBJECT (appended with the map name)
BODY will consist of a canned message including the user's e-mail
(which I believe from reading the .pod(s) that I can somewhat verify the
validity of but will NOT send to or set REPLY-TO to be his address in
the case of forgeries or whatnot) the map name in question, an optional
preferred reviewer (should they wish to specify one) and any optional
additional comments they enter in the form's textarea field for that
purpose.
and pretty much nothing else..
I suspect if I sat down with it long enough and spent many hours
trial-and-erroring my way through this I could probably eventually
understand enough of a small part of it to get where I'm going, but a
few 'working examples' would really help me to understand the *flow* of
how it should be done properly and help speed me on my way, so I can get
past this and on to the database business end of the script. (THAT I
already pretty much have my brain wrapped around how I want it to work,
so that's much less of a problem at this point .. the "how" will follow
the implementation, easily)
While the .pod is probably clear enuough to someone with more experience
on that end, it's just vague enough to me, as a relative beginner, to be
more confusing at this point than it probably actually is. :)
Thanks in advance,
--
unmunge e-mail here:
#!perl -w
print map {chr(ord($_)-3)} split //, "zhepdvwhuCzhegudjrq1qhw";
# ( damn spammers. *shakes fist* take a hint. =:P )
------------------------------
Date: 8 Feb 2001 11:14:19 GMT
From: inwap@best.com (Joe Smith)
Subject: Re: Need Help Checking IP Address Syntax w/ PERL?
Message-Id: <95tv2b$2c9h$1@nntp1.ba.best.com>
In article <95phkl$jhn$1@nnrp1.deja.com>, webbgroup <joelwebb@usa.net> wrote:
>I will try this, but can you explain the example down below a little
>more??
>What is socket??
It's not "socket". It's "use Socket;". It's a standard perl module.
Use the command line "perldoc Socket" to read the documentation
on the Socket.pm module.
use Socket;
>> $ip = inet_ntoa ($ip);
>> die "invalid address"
>> unless $ip;
>> $ip = inet_aton ($ip);
use Socket;
print "Enter hostname or dotted quad: ";
chomp ($host_name_or_ip_addr = <STDIN>);
$IPv4_32bits = inet_aton($host_name_or_ip_addr);
die "invalid: $host_name_or_ip_addr" unless defined $IPv4_32bits;
$dotted_quad = inet_ntoa($IPv4_32bits);
print "$host_name_or_ip_addr = [$dotted_quad]\n";
--
See http://www.inwap.com/ for PDP-10 and "ReBoot" pages.
------------------------------
Date: 8 Feb 2001 11:24:21 GMT
From: inwap@best.com (Joe Smith)
Subject: Re: Need Help Checking IP Address Syntax w/ PERL?
Message-Id: <95tvl5$2cbj$1@nntp1.ba.best.com>
In article <95pi89$kb4$1@nnrp1.deja.com>, webbgroup <joelwebb@usa.net> wrote:
>
>> You don't even seem to think that "127.0.0.1" is a valid IP address.
>
>My test isn't going to test the loopback address.
24.0.1.2 is a valid IP address, are you planing to reject that?
Are you aware that "301858907" is a perfectly legitimate IP address?
Try it. http://301858907/ is a real web site.
-Joe
--
See http://www.inwap.com/ for PDP-10 and "ReBoot" pages.
------------------------------
Date: 8 Feb 2001 11:35:10 GMT
From: inwap@best.com (Joe Smith)
Subject: Re: Need Help Checking IP Address Syntax w/ PERL?
Message-Id: <95u09e$2ce6$1@nntp1.ba.best.com>
In article <cxc3ddq4n9t.fsf@janus.uio.no>,
Peter J. Acklam <jacklam@math.uio.no> wrote:
>webbgroup <webbgroup@my-deja.com> writes:
>
>> I am writing a script right now that is asking for an IP
>> address. It needs to check the syntax with limiting it to a
>> valid IP address.
>
>If you want a regex-only approach, you can use
>
> sub isip {
> local $_ = shift;
> / \A
> (?: [0-1]?[0-9]?[0-9] | 2[0-4][0-9] | 25[0-5] )
> (?: \. (?: [0-1]?[0-9]?[0-9] | 2[0-4][0-9] | 25[0-5] ) ) {3}
> \z
> /x;
> }
I can "ping 192.18.25073" and I can "nslookup 192.18.25073" but the
above regex does not allow that IP address.
--
See http://www.inwap.com/ for PDP-10 and "ReBoot" pages.
------------------------------
Date: 08 Feb 2001 13:03:02 +0100
From: jacklam@math.uio.no (Peter J. Acklam)
Subject: Re: Need Help Checking IP Address Syntax w/ PERL?
Message-Id: <wkhf25qt55.fsf@math.uio.no>
inwap@best.com (Joe Smith) writes:
> Peter J. Acklam <jacklam@math.uio.no> wrote:
>
> > If you want a regex-only approach, you can use
> >
> > sub isip {
> > local $_ = shift;
> > / \A
> > (?: [0-1]?[0-9]?[0-9] | 2[0-4][0-9] | 25[0-5] )
> > (?: \. (?: [0-1]?[0-9]?[0-9] | 2[0-4][0-9] | 25[0-5] ) ) {3}
> > \z
> > /x;
> > }
>
> I can "ping 192.18.25073" and I can "nslookup 192.18.25073" but
> the above regex does not allow that IP address.
Is it really an IP address? I thought an IP address was four
numbers in the range 0..255, each separated by a dot...?
Peter
--
sub int2roman{@x=split//,sprintf'%04d',shift;@r=('','I','V','X','L','C','D'
,'M');@p=([],[1],[1,1],[1,1,1],[1,2],[2],[2,1],[2,1,1],[2,1,1,1],[1,3],[3])
;join'',@r[map($_+6,@{$p[$x[0]]}),map($_+4,@{$p[$x[1]]}),map($_+2,@{$p[$x[2
]]}),map($_+0,@{$p[$x[3]]})];}print "@{[map{int2roman($_)}@ARGV]}\n";#JAPH!
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 241
**************************************