[18390] in Perl-Users-Digest
Perl-Users Digest, Issue: 558 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Mar 24 06:05:41 2001
Date: Sat, 24 Mar 2001 03:05:14 -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: <985431914-v10-i558@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sat, 24 Mar 2001 Volume: 10 Number: 558
Today's topics:
C++ call <eg344@nyu.edu>
Re: Can perl handle 'fields' like awk can? (Garry Williams)
Re: every 15 seconds <bigrich318@yahoo.com>
Re: every 15 seconds (Gwyn Judd)
Re: form to mail Can I send the mail as an attachment? <thomastk@prodigy.net>
Re: Hmmm... Which PERL Book Is Best Suited For This??? (Jay Tilton)
Re: Hmmm... Which PERL Book Is Best Suited For This??? (---Pete---)
How adding Hours & Days to current date? (MAC)
Re: How adding Hours & Days to current date? (Steve Lamb)
Re: How adding Hours & Days to current date? <philipg@atl.mediaone.net>
Re: How adding Hours & Days to current date? (Logan Shaw)
Re: How adding Hours & Days to current date? (Logan Shaw)
How can I create HTML-formatted email? <kevenl@excite.com>
Re: How can I create HTML-formatted email? (Logan Shaw)
Re: How can I create HTML-formatted email? <thomastk@prodigy.net>
Multidimensional Arrays? <milliwave@rfengineering.freeserve.co.uk>
Re: Multidimensional Arrays? <wuerz@yahoo.com>
Re: Need help with script as I suck at perl. (BUCK NAKED1)
Re: POST method and cgi.pm <thomastk@prodigy.net>
Re: Problem using Archive::Zip (BUCK NAKED1)
Re: Question: Addressing Strings? <skuo@mtwhitney.nsc.com>
Re: regexp exception confusion <wyzelli@yahoo.com>
SSL Form, then writing to a file <usequity@mindspring.com>
Re: use CGI error (Cosmic Cruizer)
Re: Weird(?) magic word for sh to invoke perl under Lin (Alan Barclay)
Re: Weird(?) magic word for sh to invoke perl under Lin (Alan Barclay)
Re: Wild Card Problem! (BUCK NAKED1)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 24 Mar 2001 01:55:56 -0500
From: "Eduard Grinvald" <eg344@nyu.edu>
Subject: C++ call
Message-Id: <vCXu6.1$Hh2.276@typhoon.nyu.edu>
Hello all!!
I need help :)
is there any way to execute calls to a c++ method and store the return value
>From inside a perl script?
The method is located in a precompiled library.
Thank you
eduard
------------------------------
Date: Sat, 24 Mar 2001 04:48:56 GMT
From: garry@zvolve.net (Garry Williams)
Subject: Re: Can perl handle 'fields' like awk can?
Message-Id: <slrn9bo9po.ej4.garry@zfw.zvolve.net>
[please place your comments *after* the quoted text you are commenting on]
[post reordered]
[fixed broken line wrapping]
On 23 Mar 2001 19:26:18 GMT, e <sendthis@yahoo.delthisandasdf.com> wrote:
> In article <slrn9bn40d.h9i.abigail@tsathoggua.rlyeh.net>, abigail@foad.org
> says...
>>e (sendthis@yahoo.delthisandasdf.com) wrote on MMDCCLXI September
>>MCMXCIII in <URL:news:AB908D5F12924C82.8EB88DD09177740B.ED3AA4EA29F2BC31@lp.airnews.net>:
>>%% I'm not very familiar with PERL, I have a book opened, but it doesn't seem to
>>%% tell how to manipulate data separated by delimiters or i'm not using the righ
>>%% keywords to look it up.
>>
>>split
>>
>>%% I want to access the 7th field, data after the 6th <tab>. I'm trying to write
>>%% all my scripts in PERL to handle my data at work since it's more flexible.
>>%%
>>%% I want the equivalent of
>>%%
>>%% awk { print $7 }
>>%%
>>%% Is there an easy way to do this in perl?
>>
>>
>>perl -nawle 'print $F [6]'
>
> That didn't work.
What does that mean?
> I assumed I replaced $F with $<var> but I tried it both ways
> just in case.
What does that mean?
$ cat > file
1 2 3 4 5 6 7 8 9
one two three four five six seven eight
$ perl -nawle 'print $F [6]' file
7
seven
$
> This is what I'm trying to do... (not exactly.)
[snip]
Others have made suggestions.
--
Garry Williams
------------------------------
Date: Sat, 24 Mar 2001 04:10:38 -0600
From: "Rich" <bigrich318@yahoo.com>
Subject: Re: every 15 seconds
Message-Id: <tboskq5em98gb7@corp.supernews.com>
"Randal L. Schwartz" <merlyn@stonehenge.com> wrote in message
news:m1y9twumfs.fsf@halfdome.holdit.com...
> This would be simpler, and sleeps until the even multiples of 15 seconds:
>
> while (1) {
> sleep 15 - time % 15;
> ... do task here ...
> }
I may be missing something here but I don't understand how that addresses
the challenge of outputting information every 15 seconds regardless of how
long it took for the information to be compiled (from 0 - 15 seconds). The
op had asked how to output something every 15 seconds. Simple enough. But
Mr. Scheper added the challenge: "Ahh.. But what if print "Hello World!" is
replaced with something that takes several seconds to complete, but at
other times just miliseconds?".
When I replaced "...do task here.." ,in your example, with a task that took
anywhere from 0 - 10 seconds, the output was not displayed in 15 second
intervals. It was my understanding that the output from "...do task here.."
was to be displayed every 15 seconds regardless of how long it took "...do
task here.." to complete (up to 15 seconds of course).
Test 1:
use strict;
for (1..4){
sleep 15 - time % 15;
my $output = &delayed_output;
print $output.'/ Displayed-'.scalar(localtime())."\n";
}
sub delayed_output {
#delay up to 10 seconds
my $delay = int(rand(11));
sleep($delay);
return "Delayed $delay seconds";
}
Results:
Delayed 5 seconds/ Displayed-Sat Mar 24 01:39:05 2001
Delayed 3 seconds/ Displayed-Sat Mar 24 01:39:18 2001
Delayed 2 seconds/ Displayed-Sat Mar 24 01:39:32 2001
Delayed 5 seconds/ Displayed-Sat Mar 24 01:39:50 2001
Test 2:
use strict;
for (1..4){
my $before = time;
my $output = &delayed_output;
my $after = time;
sleep(15-($after-$before));
print $output.'/ Displayed-'.scalar(localtime())."\n";
}
sub delayed_output {
#delay up to 10 seconds
my $delay = int(rand(11));
sleep($delay);
return "Delayed $delay seconds";
}
Results:
Delayed 1 seconds/ Displayed-Sat Mar 24 01:43:27 2001
Delayed 9 seconds/ Displayed-Sat Mar 24 01:43:42 2001
Delayed 2 seconds/ Displayed-Sat Mar 24 01:43:57 2001
Delayed 8 seconds/ Displayed-Sat Mar 24 01:43:12 2001
Regardless of how long it takes to gather the information, it is output in
15 second intervals.
If I'm missing something here, somebody please explain.
My example may not be the most efficient (I didn't spend a lot of time on
it) but it outputs the information every 15 seconds exactly (depending on
your definition of exactly) regardless of how long it took for the
information to be compiled (up to 15 seconds, 10 seconds in the example).
Don't get me wrong, I'm not being defensive or argumentative. Heck, I've
only been programming Perl since Tuesday and I'm only half way through
Learning Perl (2nd ed.). A couple more chapters and I should be able to
wrap up this spherical trigonometry module I'm developing :^).
Rich
------------------------------
Date: Sat, 24 Mar 2001 10:36:32 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: every 15 seconds
Message-Id: <slrn9bou5d.boo.tjla@thislove.dyndns.org>
I was shocked! How could Rich <bigrich318@yahoo.com>
say such a terrible thing:
>
>"Randal L. Schwartz" <merlyn@stonehenge.com> wrote in message
>news:m1y9twumfs.fsf@halfdome.holdit.com...
>
>> This would be simpler, and sleeps until the even multiples of 15 seconds:
>>
>> while (1) {
>> sleep 15 - time % 15;
>> ... do task here ...
>> }
>
>I may be missing something here but I don't understand how that addresses
>the challenge of outputting information every 15 seconds regardless of how
>long it took for the information to be compiled (from 0 - 15 seconds). The
>When I replaced "...do task here.." ,in your example, with a task that took
>anywhere from 0 - 10 seconds, the output was not displayed in 15 second
>intervals. It was my understanding that the output from "...do task here.."
>was to be displayed every 15 seconds regardless of how long it took "...do
>task here.." to complete (up to 15 seconds of course).
The explanation of how to get the above method was not quite complete.
The psuedocode should be more like:
while (1) {
# do task here
sleep 15 - time % 15
# print results of task here
}
If you do it that way it works. In your two examples, the first one is
more or less a direct copy of the wrong instructions. What happens is
that you will sleep until time is an exact multiple of 15 (time % 15 ==
0). Then you do the task that can take a random amount of time. Then you
print the results, ergo, the time between printing out each set of
results is anywhere between 0 seconds and 30 seconds.
The second method performs a task which can take a random amount of time
and then sleeps till time is a multiple of 15 above. Then it prints the
results of the task.
--
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
"Yes, I know all about you and the Minbari."
-- Col. Ari Ben Zayn (to Sinclair), "Eyes"
------------------------------
Date: Thu, 22 Mar 2001 01:36:48 -0600
From: "Thomas Theakanath" <thomastk@prodigy.net>
Subject: Re: form to mail Can I send the mail as an attachment??
Message-Id: <99hpor$7s1i$1@newssvr05-en0.news.prodigy.com>
I guess, the form data file can be 'uuencode'd and add to the mail body.
which will reach the recipient as attachment. So, if your script is on UNIX,
it is very easy. It would be something like as below:
make mail body string , $mail_str
create form data file, x.frm
#Give some unique values to x.frm and x.uu to avoid overwriting.
system("uuencode x.frm x.frm >x.uu");
open(UU,"x.uu");
while (<UU>) {$mail_str .= $_}
close(UU);
send mail.
Wing Commander <ade_101@yahoo.com> wrote in message
news:dAHu6.43787$g63.5551377@nnrp3.clara.net...
> I am using a script that e-mails the contents of the form to me.
>
> Currently the contents of the form is in the body of the e-mail, but I
would
> like to receive the form info as an attachment - is this possible??
>
> if so are there any pre-written scripts available or is it just a couple
of
> lines of code I can add to my existing script??
>
> Thanks in advance............
>
>
------------------------------
Date: Sat, 24 Mar 2001 02:11:37 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: Hmmm... Which PERL Book Is Best Suited For This???
Message-Id: <3abc01af.100351413@news.erols.com>
On Sat, 24 Mar 2001 00:33:28 GMT, bogus@erol.com (---Pete---) wrote:
>E:\Perl>perldoc -f read
>Incorrect DOS version
How rude.
I suspect that message is being generated by an old version of the DOS
'more' filter, used here to page the perldoc output if it won't all
fit on one screen. If you get the same message when you type 'more'
at the command prompt, hunt down the offending 'more.com' file
somewhere on your path, break its legs, and try again.
------------------------------
Date: Sat, 24 Mar 2001 08:05:40 GMT
From: bogus@erol.com (---Pete---)
Subject: Re: Hmmm... Which PERL Book Is Best Suited For This???
Message-Id: <3abc4e94.147976309@news.earthlink.net>
On Sat, 24 Mar 2001 02:11:37 GMT, tiltonj@erols.com (Jay Tilton)
wrote:
>On Sat, 24 Mar 2001 00:33:28 GMT, bogus@erol.com (---Pete---) wrote:
>
>>E:\Perl>perldoc -f read
>>Incorrect DOS version
>
>How rude.
>
>I suspect that message is being generated by an old version of the DOS
>'more' filter, used here to page the perldoc output if it won't all
>fit on one screen.
>If you get the same message when you type 'more'
>at the command prompt, hunt down the offending 'more.com' file
>somewhere on your path, break its legs, and try again.
-----
I renamed it to more_old.com and tried again but got the same error.
But your suggestion got me thinking on the right track.
I checked my PATH and found an old command.com version in
my \utils directory; a leftover from my old BBS days.
I deleted it and it solved the problem!
Thanks for the suggestion, its fixed now!
---pete---
------------------------------
Date: Sat, 24 Mar 2001 02:07:16 GMT
From: macv@multiweb.nl (MAC)
Subject: How adding Hours & Days to current date?
Message-Id: <ojTu6.2659$t9.228777@news.soneraplaza.nl>
Cano someone help me with this :
I need a sub routine that adds xx number of days or xx number of hour to a
already existing valid date like the current time and date.
This sub routine has to add these days or hours and checks if it is a
valid
date, and returns the new found date.
Please can someone help, cause now when i add the dates, i do not know how
to check for a valid date or time. I come to problems when i add say: 8
hours to a time when the time is already 23:59 or... adding 14 days, while
tracking the number of days in a month.
------------------------------
Date: Sat, 24 Mar 2001 02:47:18 -0000
From: grey@despair.rpglink.com (Steve Lamb)
Subject: Re: How adding Hours & Days to current date?
Message-Id: <slrn9bo2lm.46g.grey@teleute.dmiyu.org>
On Sat, 24 Mar 2001 02:07:16 GMT, MAC <macv@multiweb.nl> wrote:
>This sub routine has to add these days or hours and checks if it is a valid
>date, and returns the new found date.
The answer you seek is contained thusly: 60, 3600 and 86400.
--
Steve C. Lamb | I'm your priest, I'm your shrink, I'm your
ICQ: 5107343 | main connection to the switchboard of souls.
-------------------------------+---------------------------------------------
------------------------------
Date: Sat, 24 Mar 2001 04:36:16 GMT
From: "Philip Garrett" <philipg@atl.mediaone.net>
Subject: Re: How adding Hours & Days to current date?
Message-Id: <4vVu6.179066$Z8.37680968@typhoon.southeast.rr.com>
MAC <macv@multiweb.nl> wrote in message
news:ojTu6.2659$t9.228777@news.soneraplaza.nl...
> Cano someone help me with this :
>
> I need a sub routine that adds xx number of days or xx number of hour to a
> already existing valid date like the current time and date.
>
[snip]
To do date arithmetic, it's easier to think of time in seconds. For
example, to get the date for one day from now, you could do:
use constant SECONDS_PER_DAY => 60 * 60 * 24;
my $tomorrow = localtime( time + SECONDS_PER_DAY );
print "Tomorrow's date is $tomorrow\n";
hth,
p
------------------------------
Date: 24 Mar 2001 02:35:54 -0600
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: How adding Hours & Days to current date?
Message-Id: <99hm9a$70u$1@boomer.cs.utexas.edu>
In article <ojTu6.2659$t9.228777@news.soneraplaza.nl>,
MAC <macv@multiweb.nl> wrote:
> Cano someone help me with this :
>
>I need a sub routine that adds xx number of days or xx number of hour to a
>already existing valid date like the current time and date.
You're in luck, because someone has already written one and made
if available for free for you to download:
http://search.cpan.org/search?mode=module&query=Date%3A%3ACalc
I don't believe that module handles daylight savings time, though.
If you need that, you might want to look at using things like the
functions time(), localtime(), and gmtime(), and the module
Time::Local. You can convert dates and times into seconds, do all the
arithmetic, and then convert them back with these.
"perldoc -f time", "perldoc -f localtime", "perldoc -f gmtime",
and "perldoc Time::Local" for more information.
Hope that helps.
- Logan
--
whose? my your his her our their _its_
who's? I'm you're he's she's we're they're _it's_
------------------------------
Date: 24 Mar 2001 02:38:36 -0600
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: How adding Hours & Days to current date?
Message-Id: <99hmec$727$1@boomer.cs.utexas.edu>
In article <slrn9bo2lm.46g.grey@teleute.dmiyu.org>,
Steve Lamb <morpheus@here.not.there> wrote:
>On Sat, 24 Mar 2001 02:07:16 GMT, MAC <macv@multiweb.nl> wrote:
>>This sub routine has to add these days or hours and checks if it is a valid
>>date, and returns the new found date.
>
> The answer you seek is contained thusly: 60, 3600 and 86400.
If you're going to do it manually, you also need to take into account
leap days and daylight savings time. You didn't give the numbers for
those. Personally, I think it's better to use a module that has all
that worked out already.
- Logan
--
whose? my your his her our their _its_
who's? I'm you're he's she's we're they're _it's_
------------------------------
Date: Fri, 23 Mar 2001 21:14:53 -0500
From: Keven <kevenl@excite.com>
Subject: How can I create HTML-formatted email?
Message-Id: <3ABC031D.2080106@excite.com>
I would like to be able to write a Perl CGI script to send form
submissions as HTML-formatted email. I have found several tutorials
covering sending form data via email but they are all plain-text email.
What do I need to do to create an email message that contains HTML
formatting?
------------------------------
Date: 24 Mar 2001 02:43:52 -0600
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: How can I create HTML-formatted email?
Message-Id: <99hmo8$73c$1@boomer.cs.utexas.edu>
In article <3ABC031D.2080106@excite.com>, Keven <kevenl@excite.com> wrote:
>I would like to be able to write a Perl CGI script to send form
>submissions as HTML-formatted email. I have found several tutorials
>covering sending form data via email but they are all plain-text email.
>What do I need to do to create an email message that contains HTML
>formatting?
Step 1: Make sure you don't send this HTML e-mail to me, since
I tend to delete e-mail that comes only in HTML. Sometimes if
it contains a text and an HTML version of the message, I'll
read the text portion if I feel like it.
Step 2: To create e-mail with attachments, use the MIME-tools package.
See http://search.cpan.org/search?mode=dist&query=MIME-tools .
The super-quick summary is that you must create a MIME entity
for the mail message itself, and then you can attach things to
that entity. If you attach something with a type of
"text/html", most mail programs should figure out what to do.
Hope that helps.
- Logan
--
whose? my your his her our their _its_
who's? I'm you're he's she's we're they're _it's_
------------------------------
Date: Thu, 22 Mar 2001 01:42:11 -0600
From: "Thomas Theakanath" <thomastk@prodigy.net>
Subject: Re: How can I create HTML-formatted email?
Message-Id: <99hq2u$5t9e$1@newssvr05-en0.news.prodigy.com>
You need to set certain mail headers to be able to send html content in the
mail body. This has nothing to do with Perl CGI. You will find lots of
documentation on HTML mail standard on Internet.
Keven <kevenl@excite.com> wrote in message
news:3ABC031D.2080106@excite.com...
> I would like to be able to write a Perl CGI script to send form
> submissions as HTML-formatted email. I have found several tutorials
> covering sending form data via email but they are all plain-text email.
> What do I need to do to create an email message that contains HTML
> formatting?
>
------------------------------
Date: Fri, 23 Mar 2001 21:21:39 -0000
From: "Milliwave" <milliwave@rfengineering.freeserve.co.uk>
Subject: Multidimensional Arrays?
Message-Id: <99gelv$8pk$1@newsg3.svr.pol.co.uk>
I'm new to Perl, and have been reading about how to create a (n-row by 7
column) array?
The book I have only shows me how to access a multidimensional array, but
does not
inform me how to go about creating one?
Question1
--------------
if for example I have the folling 4 variables at some point in my perl
program,
$X $Y $Z $Y-$X
How do I create an n-row by 4 column array? Based on the variables shown
above?
or an array of hashes?I would need a small bit of explanation if it has do
with hashes!
Question2
--------------
This question relates to the one above, and would highlight the reason for
using it!
Within the elsif statement I have further if's and elsif's
elsif
{
if ($me ==1 )
{
}
elsif ( $flagA==0) and ($flagB==1)
{
printf( TEST "%10d %10d %10d %10d", $X , $Y, $Z, $P);
}
elsif ( $flagA==1) and ($flagB==0)
{
printf( TEST "%10d %10d %10d %10d", $A , $B, $C, $D);
}
else # Implies the situation when both $flagA , FlagB ==0
{
printf( TEST "%10d %10d %10d %10d", $A1 , $B1, $C1, $D1);
}
}
I would like to capture the variables at each condition and store them away
in an array
n by 4 ----array. All those variables represent affectively the same set of
data. The above is purely
an example higlighting what I hope to achieve. Your help and attention to
this query is greatly
appreciated.
Cheers
Kev
------------------------------
Date: Sat, 24 Mar 2001 07:57:57 +0100
From: Mona Wuerz <wuerz@yahoo.com>
Subject: Re: Multidimensional Arrays?
Message-Id: <240320010757573282%wuerz@yahoo.com>
In article <99gelv$8pk$1@newsg3.svr.pol.co.uk>, "Milliwave?"
<milliwave@rfengineering.freeserve.co.uk> wrote?:
> I'm new to Perl, and have been reading about how to create a (n-row by 7
> column) array?
I don't know - have you? If you don't know yourself, how would anyone
else know?
> The book I have only shows me how to access a multidimensional array, but
> does not
> inform me how to go about creating one?
Not knowing the book you're talking about, how would anyone know?
> if for example I have the folling 4 variables at some point in my perl
> program,
>
> $X $Y $Z $Y-$X
What 4 variables?
> How do I create an n-row by 4 column array?
Why do you think you need to do that?
> Based on the variables shown
> above?
Why would that make any difference?
> or an array of hashes?I would need a small bit of explanation if it has do
> with hashes!
Why do you think you need hashes!
> This question relates to the one above, and would highlight the reason for
> using it!
> Within the elsif statement I have further if's and elsif's
>
> elsif
> {
> if ($me ==1 )
> {
>
>
> }
>
> elsif ( $flagA==0) and ($flagB==1)
> {
> printf( TEST "%10d %10d %10d %10d", $X , $Y, $Z, $P);
> }
>
>
>
> elsif ( $flagA==1) and ($flagB==0)
> {
> printf( TEST "%10d %10d %10d %10d", $A , $B, $C, $D);
>
> }
>
>
> else # Implies the situation when both $flagA , FlagB ==0
> {
>
> printf( TEST "%10d %10d %10d %10d", $A1 , $B1, $C1, $D1);
>
>
> }
>
>
> }
This code does not compile?
> Your help and attention to
> this query is greatly
> appreciated.
You didn't mean to say "Your help and attention to this query is
greatly appreciated?" by any chance?
Maybe you should think about what exactly you want to do?
Maybe you shouldn't multipost to different newsgroups?
-mona?
I should drink less coffee?
------------------------------
Date: Sat, 24 Mar 2001 00:18:20 -0600 (CST)
From: dennis100@webtv.net (BUCK NAKED1)
Subject: Re: Need help with script as I suck at perl.
Message-Id: <8185-3ABC3C2C-32@storefull-242.iap.bryant.webtv.net>
..and I can't either since you supplied no code.
--dennis
------------------------------
Date: Thu, 22 Mar 2001 01:15:02 -0600
From: "Thomas Theakanath" <thomastk@prodigy.net>
Subject: Re: POST method and cgi.pm
Message-Id: <99hog1$h62$1@newssvr05-en0.news.prodigy.com>
the field values can be accessed using param method
use CGI;
$query = new CGI;
$field_value = $query->param('field-name') ;
Prasad, Victor [FITZ:K500:EXCH] <vprasad@americasm01.nt.com> wrote in
message news:99fa7p$e8c$1@bcrkh13.ca.nortel.com...
> If you have html code and you use the POST method - pass the data to a
> cgi.pm module using script - to what variable does it pass it to?
>
> How does the POST method work - I have seen it with out cgi.pm and it uses
> pack and unpack and hex commands - what are these?
>
> Any sample code of html using post passing it to a cgi.pm script for use?
> Maybe a text fields send a first and last name?
>
> Thanks,
>
> V
>
>
>
>
------------------------------
Date: Sat, 24 Mar 2001 00:17:10 -0600 (CST)
From: dennis100@webtv.net (BUCK NAKED1)
Subject: Re: Problem using Archive::Zip
Message-Id: <8184-3ABC3BE6-65@storefull-242.iap.bryant.webtv.net>
give us your code so we can troubleshoot.
--Dennis
------------------------------
Date: Fri, 23 Mar 2001 18:06:17 -0800
From: Steven Kuo x7914 <skuo@mtwhitney.nsc.com>
Subject: Re: Question: Addressing Strings?
Message-Id: <Pine.GSO.4.21.0103231805160.8660-100000@mtwhitney.nsc.com>
On Fri, 23 Mar 2001, Zac Hester wrote:
> Here's a quick question about strings in Perl...
>
> I'm trying to use strings like character arrays. Okay, I know, I know, Perl
> is a string oriented language. That's all I've heard from Perl programmers
> for quite a while now, but there's got to be a solution. If I can use the
> 'index' function to return a substring's position in a string, shouldn't
> there be an inverse of that function that returns a substring based on a
> position (or positions)?
Have you tried substr?
my $index = 0;
my $str = 'bJbubsbtb babnbobtbhbebrb bpbebrblb bHbabcbkbebr';
while (++($index = index($str,'b',$index))) {
print substr($str,$index,1);
}
------------------------------
Date: Sat, 24 Mar 2001 13:36:49 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: regexp exception confusion
Message-Id: <ISUu6.4$ql1.5216@vic.nntp.telstra.net>
"John Hall" <jhall@ifxonline.com> wrote in message
news:U1Ru6.64915$o7.2753526@news1.rdc1.sdca.home.com...
<snip>
> $datadb{_NAUGHTY_} = ( 'bob, willis, butt, weasel, olives');
>
> @naughty = split /,/, $datadb{_NAUGHTY_};
>
>
> print $datadb{_NAUGHTY_};
> print "\n";
>
> print @naughty;
> print "\n";
> untie %datadb;
>
>
>
> $newtext = <<HTML;
>
> This text consists mainly of olives good stuff, but an occasional
butt
> might pop up unexpectedly.
> Also, you are a little "weasel "bob. olives
>
> HTML
>
> print $newtext;
> print "\n";
>
> foreach $badword(@naughty) {
Try printing "$badword\n"; here
> if ($newtext =~ /.*($badword).*/) { print "found $1\n"; }
>
> }
> ________________________________________________
>
> bob, willis, butt, weasel, olives
> bob willis butt weasel olives
You shouldn't get this result printing @naughty without the quotes
unless you have done something wrong....
>
> This text consists mainly of olives good stuff, but an occasional
butt
> might pop up unexpectedly.
> Also, you are a little "weasel "bob. olives
>
>
> found bob
> found butt
> found olives
What is the difference here between bob, and butt/olives? ***Hint -
number of spaces...***
HTH
Wyzelli
--
($a,$b,$w,$t)=(' bottle',' of beer',' on the wall','Take one down, pass
it around');
for(reverse(1..100)){$s=($_!=1)?'s':'';$c.="$_$a$s$b$w\n$_$a$s$b\n$t\n";
$_--;$s=($_!=1)?'s':'';$c.="$_$a$s$b$w\n\n";}print"$c*hic*";
------------------------------
Date: Sat, 24 Mar 2001 07:42:24 GMT
From: "Henry" <usequity@mindspring.com>
Subject: SSL Form, then writing to a file
Message-Id: <AdYu6.482733$ge4.169200928@news2.rdc2.tx.home.com>
I post information from a secure form (https) to my script, but I can't get
the script to write to a file or mail the information. I checked
permissions. Also, everything works fine if I don't reference the form
securely. Is there a special way to refer to the file under the secure
environment?
Thanks,
Henry
usequity at mindspring.com
------------------------------
Date: Sat, 24 Mar 2001 03:07:16 -0000
From: c_cruizer@my-deja.com_nospam (Cosmic Cruizer)
Subject: Re: use CGI error
Message-Id: <Xns906DC26181607ccruizermydejacom@207.126.101.100>
I used vi to create the script so I shouldn't have the ASCII/binary
problem. I took the example you suggested and created a file using vi.
After setting the perms to 755, I tried "./scriptname.cgi" (without the
quotes of course) and got the following response:
~/public_html/cgi-bin/chapt7 $ ./scriptname.cgi
"use" may clash with future reserved word at ./scriptname.cgi line 3.
syntax error in file ./scriptname.cgi at line 3, next 2 tokens "use lib"
Execution of ./scriptname.cgi aborted due to compilation errors.
~/public_html/cgi-bin/chapt7 $
By the way, it's a BSD/OS 3.0 system with perl, version 5.003_02.
efflandt@xnet.com (David Efflandt) wrote in
<slrn9bnsba.f8e.efflandt@efflandt.xnet.com>:
>Your file permissions are correct (755 dir/444 CGI.pm). Did you upload
>your script in ASCII mode (not binary)? If possible to test it in the
>shell, does it run as "./scriptname.cgi" ("perl scriptname.cgi" would not
>reveal some errors). Maybe your path or root is different on the
>web. Try this test instead:
>
>#!/usr/bin/perl -w
>print "Content-type: text/plain\n\n";
>use lib '/usr/libdata/perl5/site_perl';
>foreach (@INC) {
> if (-r "$_/CGI.pm") {
> print "Found readable $_/CGI.pm\n";
> exit;
> }
>}
>print "Can't find CGI.pm\n\n\@INC contains:\n";
>foreach (@INC) { print "$_\n"; }
>print "Current dir: ", `pwd`, "\n";
>
------------------------------
Date: 24 Mar 2001 02:37:03 GMT
From: gorilla@elaine.furryape.com (Alan Barclay)
Subject: Re: Weird(?) magic word for sh to invoke perl under Linux
Message-Id: <985401384.589378@elaine.furryape.com>
In article <3ABB7530.17806508@earthlink.net>,
Benjamin Goldberg <goldbb2@earthlink.net> wrote:
>> People putting . in their PATH will be bitten sooner or later anyway.
>
>What, even if they have it as the very last thing in their path?
>
>I'd like to see someone exploit that.
Exploiter create a program called sl
User means to type ls, but fingers slip, and she types sl instead
sl script starts a 'rm -r / > /dev/null &', then calls ls
------------------------------
Date: 24 Mar 2001 02:37:30 GMT
From: gorilla@elaine.furryape.com (Alan Barclay)
Subject: Re: Weird(?) magic word for sh to invoke perl under Linux
Message-Id: <985401449.548766@elaine.furryape.com>
In article <3ABB7530.17806508@earthlink.net>,
Benjamin Goldberg <goldbb2@earthlink.net> wrote:
>> People putting . in their PATH will be bitten sooner or later anyway.
>
>What, even if they have it as the very last thing in their path?
>
>I'd like to see someone exploit that.
Exploiter creates a program called sl
User means to type ls, but fingers slip, and she types sl instead
sl script starts a 'rm -r / 2> /dev/null &', then calls ls
------------------------------
Date: Sat, 24 Mar 2001 00:15:35 -0600 (CST)
From: dennis100@webtv.net (BUCK NAKED1)
Subject: Re: Wild Card Problem!
Message-Id: <8184-3ABC3B87-64@storefull-242.iap.bryant.webtv.net>
someone really needs more of your script in order to give you a proper
answer.
------------------------------
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 558
**************************************