[9712] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Resend: Perl-Users Digest, Issue: 3304 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Aug 1 21:04:51 1998

Date: Sat, 1 Aug 98 17:59:05 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sat, 1 Aug 1998     Volume: 8 Number: 3304

Today's topics:
    Re: regexp question <*@qz.to>
    Re: Regular expressions for Perl 5 <thomas@daimi.aau.dk>
    Re: Regular expressions for Perl 5 (Kevin Reid)
    Re: removing accented characters from a string (Mark-Jason Dominus)
    Re: restore STDIN (Andrew M. Langmead)
    Re: running an exe from a perl script <simonf@conduit.co.uk>
    Re: s/// Regexp parsing oddity with negative lookahead  (Tye McQueen)
        s///e -- What does it actually do? (Matt Knecht)
    Re: s///e -- What does it actually do? (Abigail)
    Re: s///e -- What does it actually do? (Craig Berry)
    Re: s///e -- What does it actually do? (Matt Knecht)
    Re: s///e -- What does it actually do? (Michael J Gebis)
    Re: s///e -- What does it actually do? (Ilya Zakharevich)
    Re: s///e -- What does it actually do? (Matt Knecht)
        Scheduling subroutines (Paul)
    Re: seeing if a file exists. (Andrew M. Langmead)
    Re: seeing if a file exists. (Alan Barclay)
    Re: Sending e-mail using cgi (Christophe Gerbier)
    Re: Sending out eMails in predefined intervals ? (-)
    Re: sendmail on NT server? (Andy Lester)
        Soooo Sorry :-)))) <MSchmidt@riedlingen.netsurf.de>
        split "+" <fcalabro@aisvt.bfg.com>
    Re: split "+" (Ronald J Kimball)
    Re: split "+" (Michael J Gebis)
    Re: split "+" (Craig Berry)
    Re: split "+" <joneil@cks.ssd.k12.wa.us>
    Re: split "+" (Steve Linberg)
    Re: split "+" <tonylabb@infonline.net>
    Re: split "+" <jdporter@min.net>
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: 31 Jul 1998 18:14:41 GMT
From: Eli the Bearded <*@qz.to>
Subject: Re: regexp question
Message-Id: <eli$9807311414@qz.little-neck.ny.us>

In comp.lang.perl.misc, Kelly Hirano <hirano@Xenon.Stanford.EDU> wrote:
> William Wueppelmann <william@host.ott.igs.net> wrote:
> >Tim Gray (tim@hcirisc.cs.binghamton.edu) wrote:
> >: Why doesn't this expression
> >: m/<font.*?\s(SIZE=.*?)[>\s]/
> >Is '*?' supposed do something? (It may, but it seems to me like an error.)
> the '?' makes the match non-greedy instead of greedy. that is, it looks for
> the shortest possible matchi instead of the longest. 

It DOES NOT look for the shortest possible match. This is why people
constantly screw up with it. Non-greedy matching looks for the leftmost
shortest match. In this case the RE will begin matching at the first
"<font" and then continue on until it finds the first "\sSIZE=" and
then continue on again util it finds the first "[>\s]". This will
do very odd things if you expected the RE to ignore, say,
'<font face="typeface">' tags.

Elijah
------
avoids non-greedy matching


------------------------------

Date: Fri, 31 Jul 1998 23:37:42 +0200
From: Thomas Jespersen <thomas@daimi.aau.dk>
Subject: Re: Regular expressions for Perl 5
Message-Id: <35C23926.EB5DACA@daimi.aau.dk>

drive@mbox4.singnet.com.sg wrote:
 
> In addition, what do these 2 lines do ?
> 1) $input =~ s/\&/\&amp\;/g;
> 2) $input =~ s/"/\&quot\;/g;

1) Replace all occurences of & with &amp;

2) Replace all occurences of " with &quot;

probably part of some cgi-script? It replaces & and " with their
equivalent HTML-entities


Look at perlop and perlre manpages for more info


------------------------------

Date: Thu, 30 Jul 1998 15:46:02 -0400
From: kpreid@ibm.net (Kevin Reid)
Subject: Re: Regular expressions for Perl 5
Message-Id: <1dczje7.1hzk86919jbjcaN@slip166-72-108-190.ny.us.ibm.net>

<drive@mbox4.singnet.com.sg> wrote:

> Hello,
> 
> Happen to come across this discussion which is quite similar to what I
> have encountered.....I hope you guys can offer me your expert advice on
> the following problems that I had encountered......
> 
> I have a text file that contains line after line of "subject titles". I
> have written a perl script to read in these strings and compare them one
> by one to see if it matches a specific string "$input".
> 
> I used :
> 
> If ($subject = ~/$input/) {
> ......}
> else {........}
> 
> I encountered the error saying ".....nested +?*....." 'cos  $input
> contains "???" at the end of the string (eg. What is wrong???) which is
> valid. Is there a way to compare this string no that I would not have
> problems with "nested ?" ?
> 
> Besides "?", does this error also occur with "!", ",", "." ?

Try /\Q$input\E/.

Also, that line should probably be:

if ($subject =~ /\Q$input/) {

Multi-character operators must not have spaces between the characters.

> In addition, what do these 2 lines do ?
> 1) $input =~ s/\&/\&amp\;/g;
> 2) $input =~ s/"/\&quot\;/g;

They substitute &amp; for & and &quot; for ".

The backslashes are not neccessary.

> 
> And also, how do I replace " with '
> 
>       $input =~ s/"/'/g;   ---- does this work?

Try it.

-- 
  Kevin Reid.      |         Macintosh.
   "I'm me."       |      Think different.


------------------------------

Date: 31 Jul 1998 15:51:32 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: removing accented characters from a string
Message-Id: <6pt784$9po$1@monet.op.net>

In article <1dcy2xj.4vnwznav3m0bN@bay1-90.quincy.ziplink.net>,
Ronald J Kimball <rjk@coos.dartmouth.edu> wrote:
>You could also specify the accented letters by ASCII value:
>
>tr/\x96/n/;

This is just a nitpick, but you can't specify an accented chracter
with an ASCII value, because ASCII doesn't contain codings for any
accented characters, and in fact only defines codes for 128
characters.

Which is how we got into this mess in the first place.

Fortunately, as Ron points out, if your document hapens to use the
ISO-Latin-1 encoding, you can specify the characters by ISO-Latin-1
values.



------------------------------

Date: Fri, 31 Jul 1998 18:01:39 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: restore STDIN
Message-Id: <Ewz0qs.9v4@world.std.com>

Adrian Lucas <lucasda@prl.research.philips.com> writes:

>Is it possible in Perl (under HPUX version of Unix) to read from the
>keyboard but exit with anything initially on STDIN still there for
>subsequent scripts/programs?

If you spawn the subsequent program from your perl script, you could
pass whatever the first script received.

open CHILD, '| subsequent_program' 
         or die "Unable to run subsequent_program: $!\n";

while(<STDIN>) {
  print CHILD;
}
close CHILD or die "Error running subsequent_program: $!\n";

-- 
Andrew Langmead


------------------------------

Date: Thu, 30 Jul 1998 11:07:50 +0100
From: "Simon Fairey" <simonf@conduit.co.uk>
Subject: Re: running an exe from a perl script
Message-Id: <35c04534.0@nnrp1.news.uk.psi.net>

Look at system() in the perlfunc manpage, i.e

system "/path_to_script/Launch.sh";
Simon

Khadidja Malleck wrote in message <35C01ECD.4C03087C@dsi.cnrs.fr>...
>Hello!
>
>I would like to know how to call a program from within a perl script?
>I have a file called Launch.sh and the permissions are set in 755 and I
>want to call it from a perl script.
>Can anyone help me please???
>
>Thanks a lot.
>
>Khadidja Malleck
>malleck@dsi.cnrs.fr




------------------------------

Date: 29 Jul 1998 02:22:59 -0500
From: tye@fumnix.metronet.com (Tye McQueen)
Subject: Re: s/// Regexp parsing oddity with negative lookahead assertion
Message-Id: <6pmikj$8sc@fumnix.metronet.com>

"Brendan McMahon" <bmcmahon@iol.ie> writes:
) I'm trying to scan a HTML file and repeatedly remove paired open/close tags
) which may be recursively nested, using a '1 while s///' type repeat.
) 
) To do this, I figured the nested tags can only be identified from the inside
) out, i.e. opening-tag not followed by any more opening tags before
) encountering a closing tag.
) 
) If <f> and <xf> represent the opening and closing tags, I figured that the
) following, based on a negative lookahead assertion, would work, and it does:
) 
) C:\>perl -e "$_='a<f>b<f>c<f>d<xf>e<xf>f<xf>g';
) s/<f>(?!.*?<f>.*?<xf>)(.*?)<xf>/$1/gsi  ;print"
) a<f>b<f>cde<xf>f<xf>g
) 
) However, the problem is that the opening tag can contain attributes, so I
) made the obvious changes:
) 
) C:\>perl -e "$_='a<f>b<f>c<f>d<xf>e<xf>f<xf>g';
) s/<f.*?>(?!.*?<f.*?>.*?<xf>)(.*?)<xf>/$1/gsi;print"
      !!!

Try:
  s/<f[^>]*>(...

instead.  ".*?" tries to match as little as possible but it will
match ">b<f>c<f" if it has to in order to succeed.

) show that this term is matching greedily, despite the ? lazy match
) quantifier.

It isn't matching greedily.  It is trying to match as little as
possible -- trying to be as ungreedy as possible.  But the greedy
".*" will match the empty string if that is the _only_ way it can
succeed and ".*?" will match as much as it _has to_ to succeed.
-- 
Tye McQueen    Nothing is obvious unless you are overlooking something
         http://www.metronet.com/~tye/ (scripts, links, nothing fancy)


------------------------------

Date: Fri, 31 Jul 1998 15:00:51 GMT
From: hex@voicenet.com (Matt Knecht)
Subject: s///e -- What does it actually do?
Message-Id: <D_kw1.211$9t2.2655944@news3.voicenet.com>

andy barfoot <abarfoot@eng.auburn.edu> wrote:
>The 'e' flag to s/// causes the replacement pattern to be eval'ed.

I've always thought of the 'e' modifier wasn't an eval, but just an
order to execute instead of replace.  It seems like a fine hair to split,
but I get a strong feeling of auto-magic with eval.

So, I decided to test this out, and was having some trouble trying to
determine if the 'e' modifier actually does do a real eval.  I decided
that the best test would be to attempt something from perlfunc eval.
The division by zero example.

#!/usr/local/bin/perl -w

$a = 1;
$b = 0;
$_ = 'a string';

s!.*!$a / $b!e;

print "I didn't die";
__END__

When I run it I get:
llegal division by zero at ./tst_eval line 7.

It never gets to the print "I didn't die".  It seems that my hunch was
right.  Now, I have the question what exactly is going on with 'e'?
Exactly how does it differ from an eval?

-- 
Matt Knecht - <hex@voicenet.com>


------------------------------

Date: 31 Jul 1998 16:37:28 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: s///e -- What does it actually do?
Message-Id: <6psrs8$bn3$1@client3.news.psi.net>

Matt Knecht (hex@voicenet.com) wrote on MDCCXCV September MCMXCIII in
<URL: news:D_kw1.211$9t2.2655944@news3.voicenet.com>:
++ andy barfoot <abarfoot@eng.auburn.edu> wrote:
++ >The 'e' flag to s/// causes the replacement pattern to be eval'ed.
++ 
++ I've always thought of the 'e' modifier wasn't an eval, but just an
++ order to execute instead of replace.  It seems like a fine hair to split,
++ but I get a strong feeling of auto-magic with eval.
++ 
++ So, I decided to test this out, and was having some trouble trying to
++ determine if the 'e' modifier actually does do a real eval.  I decided

What's a "real eval"? As opposed to what? An "unreal eval"? And what
else is an eval but "an order to execute"? It's just that the result
of the evaluation will be used as the replacement string.

++ that the best test would be to attempt something from perlfunc eval.
++ The division by zero example.
++ 
++ #!/usr/local/bin/perl -w
++ 
++ $a = 1;
++ $b = 0;
++ $_ = 'a string';
++ 
++ s!.*!$a / $b!e;
++ 
++ print "I didn't die";
++ __END__
++ 
++ When I run it I get:
++ llegal division by zero at ./tst_eval line 7.
++ 
++ It never gets to the print "I didn't die".  It seems that my hunch was
++ right.  Now, I have the question what exactly is going on with 'e'?
++ Exactly how does it differ from an eval?


Well, you tell us! You are the one convinced it's different from an eval!



Abigail
-- 
perl -wleprint -eqq-@{[ -eqw\\- -eJust -eanother -ePerl -eHacker -e\\-]}-


------------------------------

Date: 31 Jul 1998 17:38:09 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: s///e -- What does it actually do?
Message-Id: <6psve1$hm1$2@marina.cinenet.net>

Abigail (abigail@fnx.com) wrote:
: ++ It never gets to the print "I didn't die".  It seems that my hunch was
: ++ right.  Now, I have the question what exactly is going on with 'e'?
: ++ Exactly how does it differ from an eval?
: 
: Well, you tell us! You are the one convinced it's different from an eval!

I think his point is that if you do

  eval '1/0';

your script will not die, and $@ will be set with the error; but if you do

  $a = 'foo';
  $a =~ s!f!1/0!e;

your script will die, rathern than continuing with $@ set.  Thus, the eval
inside a replacement with /e is in at least one respect dissimilar from a
'real' eval (that is, one directly using the eval() function).

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


------------------------------

Date: Fri, 31 Jul 1998 17:49:32 GMT
From: hex@voicenet.com (Matt Knecht)
Subject: Re: s///e -- What does it actually do?
Message-Id: <Msnw1.390$NJ5.2740628@news2.voicenet.com>

Abigail <abigail@fnx.com> wrote:
>What's a "real eval"? As opposed to what? An "unreal eval"? And what
>else is an eval but "an order to execute"? It's just that the result
>of the evaluation will be used as the replacement string.

A real eval is when you call eval explicitly by typing something like:

eval $something;

or

eval { print $something; };

As opposed to a hidden or "unreal" eval like:

s/.*/func()/e

I thought this point was clear in my original post.  Sorry if it didn't
come across.

>++ It never gets to the print "I didn't die".  It seems that my hunch was
>++ right.  Now, I have the question what exactly is going on with 'e'?
>++ Exactly how does it differ from an eval?
>
>Well, you tell us! You are the one convinced it's different from an eval!

eval catches fatal errors.  s///e does not.  I am curious if there are
other differences.  Again, I thought I made this clear.  If it still is
unclear, I'm not sure how I can explain better.

-- 
Matt Knecht - <hex@voicenet.com>


------------------------------

Date: 31 Jul 1998 19:40:57 GMT
From: gebis@fee.ecn.purdue.edu (Michael J Gebis)
Subject: Re: s///e -- What does it actually do?
Message-Id: <6pt6k9$6t0@mozo.cc.purdue.edu>

hex@voicenet.com (Matt Knecht) writes:
}Abigail <abigail@fnx.com> wrote:
}>What's a "real eval"? As opposed to what? An "unreal eval"? And what
}>else is an eval but "an order to execute"? It's just that the result
}>of the evaluation will be used as the replacement string.

}A real eval is when you call eval explicitly by typing something like:

}eval $something;

}or

}eval { print $something; };

}As opposed to a hidden or "unreal" eval like:

}s/.*/func()/e

}I thought this point was clear in my original post.  Sorry if it didn't
}come across.

}>++ It never gets to the print "I didn't die".  It seems that my hunch was
}>++ right.  Now, I have the question what exactly is going on with 'e'?
}>++ Exactly how does it differ from an eval?
}>
}>Well, you tell us! You are the one convinced it's different from an eval!

}eval catches fatal errors.  s///e does not.  I am curious if there are
}other differences.  Again, I thought I made this clear.  If it still is
}unclear, I'm not sure how I can explain better.

On page 73 of Das Camel, Larry "Berlin" Wall and comrades have
written, "It's kind of like an eval, but its syntax is checked at
compile time."

Note the use of "kind of like" indicating that it's not "exactly like"
which thus bolsters your assertion.

-- 
Mike Gebis  gebis@ecn.purdue.edu  mgebis@eternal.net


------------------------------

Date: 31 Jul 1998 20:48:14 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: s///e -- What does it actually do?
Message-Id: <6ptaie$rsp$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Abigail
<abigail@fnx.com>],
who wrote in article <6psrs8$bn3$1@client3.news.psi.net>:
> Matt Knecht (hex@voicenet.com) wrote on MDCCXCV September MCMXCIII in
> ++ So, I decided to test this out, and was having some trouble trying to
> ++ determine if the 'e' modifier actually does do a real eval.  I decided
> 
> What's a "real eval"? As opposed to what? An "unreal eval"? And what
> else is an eval but "an order to execute"? It's just that the result
> of the evaluation will be used as the replacement string.

No, it is the result of *execution* which is used as the replacement
string.  To get *evaluation*, you need /ee.

Here are my heuristic:
     
     a) consider s(RE)( CODE )e		as a *basic* form
     b) consider s(RE)(TEXT)		as a shortcut for
		 s(RE)( qq(TEXT) )e
     c) consider s(RE)(TEXT)ee		as a shortcut for
		 s(RE)(  eval qq(TEXT) )e

It helps that now your opinion coincides with the Perl's one ;-).

Ilya


------------------------------

Date: Fri, 31 Jul 1998 21:44:09 GMT
From: hex@voicenet.com (Matt Knecht)
Subject: Re: s///e -- What does it actually do?
Message-Id: <JUqw1.484$NJ5.2870710@news2.voicenet.com>

Ilya Zakharevich <ilya@math.ohio-state.edu> wrote:
>     a) consider s(RE)( CODE )e		as a *basic* form
>     b) consider s(RE)(TEXT)		as a shortcut for
>		 s(RE)( qq(TEXT) )e
>     c) consider s(RE)(TEXT)ee		as a shortcut for
>		 s(RE)(  eval qq(TEXT) )e

Thanks for the excellent explanation.  This, and a mail I got explaining
that a single 'e' can be thought of as a do block.  Together this clears
things up.

-- 
Matt Knecht - <hex@voicenet.com>


------------------------------

Date: Thu, 30 Jul 1998 17:28:59 GMT
From: paul@cytech.net (Paul)
Subject: Scheduling subroutines
Message-Id: <35c0ab6f.71516829@nntp.bestweb.net>

I'm trying to get a perl program that runs 24/7 do a specific
subroutine at midnight everynight. Using alarm and catching $SIG{ALRM}
doesn't quite do what I want as there is no (fairly easy) way to be
able to calculate the amount of seconds until midnight using time and
then resetting the number of seconds till the next midnight in each
subroutine.

The camel book says something about using itimer routines via syscall,
but doesn't give any documentation on how to implement it.

I really don't want to crontab a kill signal if I can help it.

Any suggestions?

Paul.


------------------------------

Date: Fri, 31 Jul 1998 18:13:39 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: seeing if a file exists.
Message-Id: <Ewz1Ar.IJ3@world.std.com>

Alan Silver <alan@find-it.furryferret.uk.com> writes:

>More importantly, REMOTE_ADDR is set by the *browser*, not the server.

Can you explain to me how a program on one machine sets environment
variables for a unrelated process (a process that is not a child
process) on another machine?

And if your meaning is that the _server_ sets the REMOTE_ADDR
environment variable based on information received from the client,
can you point out where in the HTTP spec the client sends its own
address (information that the server could determine itself when it
accept()s the connection with the client?)
-- 
Andrew Langmead


------------------------------

Date: 31 Jul 1998 19:09:25 GMT
From: gorilla@elaine.drink.com (Alan Barclay)
Subject: Re: seeing if a file exists.
Message-Id: <901912162.813518@elaine.drink.com>

In article <35bd76d3.304650@news.ukonline.co.uk>,
Ollie Cook <oliver.cook@bigfoot.com> wrote:
>On 28 Jul 1998 00:19:31 GMT, mgjv@comdyn.com.au (Martien Verbruggen)
>wrote:
>>In article <35bc2928.457026@news.ukonline.co.uk>,
>>>  # Fill Out Amount, Either From File, Or Set To Zero
>>>
>>>	if (-e "$visitordir/$ENV{'REMOTE_ADDR'}") 
>>
>>Are you running under -w? Did you try using strict? Both are very good
>>practices.
>>
>>Does $ENV{'REMOTE_ADDR'} contain anything at all? If it doesn't, then
>>you will just test for the existence of $visitordir. Maybe you should
>>consider using the -f test. Either that, or test that
>>$ENV{REMOTE_ADDR} does indeed contain something useful.
>
>I thought that wouldn't be necessary since the script is always called
>from a browser and that will convey $ENV{'REMOTE_ADDR'} automatically.

It's probably a bad idea to use remote addr in this case anyway.

If the user is accessing via a proxy server, REMOTE_ADDR will
contain the address of the proxy, and therefore it is likely that
two instances both running behind the same proxy will collide.



------------------------------

Date: Thu, 30 Jul 1998 13:08:12 GMT
From: cgerbier@demeter.fr (Christophe Gerbier)
Subject: Re: Sending e-mail using cgi
Message-Id: <35c06d29.90311176@news.ipoint.fr>

On Thu, 30 Jul 1998 10:30:24 GMT, jthimont@my-dejanews.com wrote:

>I have a standard dial-up account which allow me to execute cgi scripts. I
>wondered if there is a technique to send e-mail using cgi:  From (my site) to
>an address acquired from an HTML form.	I understand that there are security
>risks using addresses entered in forms. James
>
>-----== Posted via Deja News, The Leader in Internet Discussion ==-----
>http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


You could try this :

my $mailprog = "/usr/bin/sendmail";
my $sender = "userone@some.where";
my $recipient = "usertwo@else.where";
my $reply_to = "userthree@no.where";

open (MAIL,"|$mailprog $recipient') || die "error message\n";
print MAIL "From: $sender\n";
print MAIL "To: $recipient\n";
print MAIL "Reply-to: $reply_to\n";
print MAIL "Subject: Your subject\n";
print MAIL "\n\nBody of the message.\n\n";
close (MAIL);


Regards.
ChG


------------------------------

Date: Thu, 30 Jul 1998 20:22:29 GMT
From: root.noharvest.\@not_even\here.com (-)
Subject: Re: Sending out eMails in predefined intervals ?
Message-Id: <35c0d518.185040229@news2.cais.com>

c20xe@my-dejanews.com Said this:

>Hello,
>
> I'm searching the net for month now, but don't
> find a script, I need to manage some outgoing
> eMails.
>
> On my website I have a section of about 20
> articles and now I want to offer the vistors
> to receive this articles by eMail.
>
> They should choose the intervals of receiving
> the eMails. This should be realized with a
> HTML-Form drop-down-menue, content of the
> form field would be, for example, "want to
> receive one mail *daily*", "want to receive
> one mail per *week*", ... and so on ...
>
> Can anybody help ?
>
> Are there any scripts available doing just
> that (sending out eMails in predefined
> intervals) ?

While there may or may not be any "prewritten" scripts, I can tell you
what you can do to create your own...

Set up majordomo or listserv, so that you can define your own mailing
lists.  Create a few, maybe daily@yourhost.com, weekly@ and monthly@.
Then, using perl, write a script that generates your message and
actually sends it to the respective list.  I do this with a few "news
headlines" type mailing lists, and it works great.  You set up your
mailing list to be "moderated" so nobody else can send messages out to
the list, and then crontab a simple perl script to generate the
message.

You can do it all in perl, without the mailing list manager, but I
suggest using a mailing list manager to automate the
subscription/unsubscription stuff, and to just manage the list
logically.



------------------------------

Date: 30 Jul 1998 14:38:24 GMT
From: petdance@maxx.mc.net (Andy Lester)
Subject: Re: sendmail on NT server?
Message-Id: <6pq0h0$1jn$1@supernews.com>

: Please help me. All i get from my ISP when I ask is: 'I don't know, but
: I'll pass on the question'. But since I never hear from them again, I
: guess they're not very interested in helping me.

A search at any searching engine for "sendmail and NT" will likely turn up
dozens of responses.

xoxo,
Andy

--
-- 
Andy Lester:        <andy@petdance.com>       http://tezcat.com/~andy/
Chicago Shows List: <shows@ChicagoMusic.com>  http://ChicagoMusic.com/



------------------------------

Date: Fri, 31 Jul 1998 19:00:20 +0200
From: Michael Schmidt-Maier <MSchmidt@riedlingen.netsurf.de>
Subject: Soooo Sorry :-))))
Message-Id: <35C1F824.461EDDCC@riedlingen.netsurf.de>

I promise never to post so often again. Just goofed with my Newsreader.
Again Sorry

Michael


------------------------------

Date: Fri, 31 Jul 1998 11:47:13 -0400
From: Finn Calabro <fcalabro@aisvt.bfg.com>
Subject: split "+"
Message-Id: <35C1E701.614C67BE@aisvt.bfg.com>

I am trying to split input from a form using the "GET" method as part of
a database search.  However, i haven't been able to split the input when
there is more than one word (i.e. search?name=john+doe).  I think the
line should be something like this, but I've tried many variations:
@valuelist = split( "+", $value);
including /+/, '+', '%2B', etc.  how ccan i split the variable $value
(which has already been split from the query_string at /=/).  Thanks!




------------------------------

Date: Fri, 31 Jul 1998 20:01:21 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: split "+"
Message-Id: <1dd1r1h.ydq1ea3c2k0kN@bay1-301.quincy.ziplink.net>

Tony Labbiento <tonylabb@infonline.net> wrote:

> tr/'+'/ /;

Sure, if you want to translate all the apostrophes into spaces too.  :-)

-- 
 _ / '  _      /         - aka -         rjk@coos.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


------------------------------

Date: 31 Jul 1998 17:47:18 GMT
From: gebis@fee.ecn.purdue.edu (Michael J Gebis)
Subject: Re: split "+"
Message-Id: <6psvv6$461@mozo.cc.purdue.edu>

Finn Calabro <fcalabro@aisvt.bfg.com> writes:

}I am trying to split input from a form using the "GET" method as part of
}a database search.  However, i haven't been able to split the input when
}there is more than one word (i.e. search?name=john+doe).  I think the
}line should be something like this, but I've tried many variations:
}@valuelist = split( "+", $value);
}including /+/, '+', '%2B', etc.  how ccan i split the variable $value
}(which has already been split from the query_string at /=/).  Thanks!

Does
@valuelist = split(/\+/,$value);
work?

'+' means something special.

-- 
Mike Gebis  gebis@ecn.purdue.edu  mgebis@eternal.net


------------------------------

Date: 31 Jul 1998 17:01:34 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: split "+"
Message-Id: <6pst9e$hm1$1@marina.cinenet.net>

Finn Calabro (fcalabro@aisvt.bfg.com) wrote:
: I am trying to split input from a form using the "GET" method as part of
: a database search.  However, i haven't been able to split the input when
: there is more than one word (i.e. search?name=john+doe).  I think the
: line should be something like this, but I've tried many variations:
: @valuelist = split( "+", $value);

(a) The first argument to split should be a regex, not a string (a string
works, but it just gets converted into a regex (eith a special case for 
' '), so you should write it that way.

(b) Being a regex, regex metacharacters are significant.  + is one such
metacharacter, the "one or more" quantifier.  If you need a literal plus
in your regex, you need to escape the +.

So, if you rewrite your line above like this:

  @valuelist = split(/\+/, $value);

it should work as expected.

Note by the way that taking apart CGI parms 'by hand' is almost always
wasted effort, and also very easy to get wrong.  I highly recommend
letting CGI.pm (included in the standard distribution) do this low-level
work for you.

[resuming things tried:]
: including /+/, '+',

These are both identical to the "+" you have above.  Single or double
quotes are the same in the absence of escapes or interpolation, and both
strings quietly convert to /+/ (a senseless regex) in any case.

: '%2B',

That's not how Perl creates hex-coded characters.  First, you need
double-quotes to get (most) escapes.  Second, the syntax is \x, not %.
The argument "\x2B" *would* have worked for you (thought it would be
better written as /\x2B/, and still better as /\+/).

:etc.  how ccan i split the variable $value
:(which has already been split from the query_string at /=/).  Thanks!

You should really do yourself a favor and read _Learning Perl_, doing the
exercises.  Until you can spin regexes like this in your sleep, you'll
never be comfortable with Perl.

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


------------------------------

Date: Fri, 31 Jul 1998 12:55:43 -0700
From: Jerome O'Neil <joneil@cks.ssd.k12.wa.us>
To: Tony Labbiento <tonylabb@infonline.net>, fcalabro@aisvt.bfg.com
Subject: Re: split "+"
Message-Id: <35C2213F.194085B1@cks.ssd.k12.wa.us>

Tony Labbiento wrote:
> 
> You may need to do this in steps:
> 
> $_ = $value;
> tr/'+'/ /;
> @valuelist = split;
> >but I've tried many variations:
> > @valuelist = split( "+", $value);
> > including /+/, '+', '%2B', etc.  how ccan i split the variable $value

Split splits on a regex, not a string.  As '+' is a regex metacharacter,
he needs to escape it.

split /\+/,$value;

Good Luck!

Jerome







 .


------------------------------

Date: Fri, 31 Jul 1998 13:18:52 -0400
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: split "+"
Message-Id: <linberg-3107981318520001@pri03-009.oldcity.dca.net>

In article <35C1E701.614C67BE@aisvt.bfg.com>, Finn Calabro
<fcalabro@aisvt.bfg.com> wrote:

> I am trying to split input from a form using the "GET" method as part of
> a database search.  However, i haven't been able to split the input when
> there is more than one word (i.e. search?name=john+doe).  I think the
> line should be something like this, but I've tried many variations:
> @valuelist = split( "+", $value);
> including /+/, '+', '%2B', etc.  how ccan i split the variable $value
> (which has already been split from the query_string at /=/).  Thanks!

Use CGI.pm, included in your Perl distribution.  It will make all your
headaches go away.
_______________________________________________________________________
Steve Linberg                         National Center on Adult Literacy
Systems Programmer &c                        University of Pennsylvania
linberg@literacy.upenn.edu                http://www.literacyonline.org


------------------------------

Date: Fri, 31 Jul 1998 14:17:03 -0400
From: Tony Labbiento <tonylabb@infonline.net>
Subject: Re: split "+"
Message-Id: <35C20A1F.BD51B137@infonline.net>

You may need to do this in steps:

$_ = $value;
tr/'+'/ /;
@valuelist = split;


Finn Calabro wrote:
> 
> I am trying to split input from a form using the "GET" method as part of
> a database search.  However, i haven't been able to split the input when
> there is more than one word (i.e. search?name=john+doe).  I think the
> line should be something like this, but I've tried many variations:
> @valuelist = split( "+", $value);
> including /+/, '+', '%2B', etc.  how ccan i split the variable $value
> (which has already been split from the query_string at /=/).  Thanks!

-- 
			****************************************
			*    Tony Labbiento                    *
			*    Infinity Online, Inc.             *
			****************************************


------------------------------

Date: Fri, 31 Jul 1998 19:10:55 GMT
From: John Porter <jdporter@min.net>
Subject: Re: split "+"
Message-Id: <35C21759.5CE5@min.net>

Tony Labbiento wrote:
> 
> $_ = $value;
> tr/'+'/ /;
> @valuelist = split;

But this is just plain wrong.  
Why do you think HTTP encodes '+'s into the arg string
in the first place?  Because it can't use space!

-- 
John Porter


------------------------------

Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 3304
**************************************

home help back first fref pref prev next nref lref last post