[8673] in Perl-Users-Digest
Perl-Users Digest, Issue: 2290 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Apr 10 12:17:17 1998
Date: Fri, 10 Apr 98 09:00:27 -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 Fri, 10 Apr 1998 Volume: 8 Number: 2290
Today's topics:
[Fwd: Variable in reguldren Ausdr|cken] <10707.3645@compuserve.com>
ANNOUNCE: IPC open2/open3 emulation module for Win32 (RonaldWS)
Re: Bill Gates should be invited to O'Reilly's "Free So <nelson@crynwr.com>
Re: Can somebody help me understand the internals of "C (M.J.T. Guy)
Can someone give me an example of rounding! <poohba@io.com>
Clunky Perl Prose (Michael Stillwell)
Re: Easy package/sub-routine ? <rootbeer@teleport.com>
General Rudeness, e.g. Re: Need a web login script <sonny@88net.net>
Re: help with delimiters (Hunter Johnson)
Re: help with delimiters <ludlow@us.ibm.com>
Re: Looking for Polling/Voting CGI/java Script <rootbeer@teleport.com>
Re: May can you help, please? <rootbeer@teleport.com>
Multi-dimensional Array Access <jerome.bradenbaugh@firstunion.com>
Re: Multi-dimensional Array Access <jdf@pobox.com>
Re: New error? I can't open a file to write! <rootbeer@teleport.com>
Perl and procmail (Paul L. Lussier)
Re: PERL SUBROUTINES.... <rootbeer@teleport.com>
Re: perl win 32 : asterisk on command line <$_=qq!fearless\@NOSPAMio.com!;y/A-Z//d;print>
Re: problem printing long line to file <rootbeer@teleport.com>
Re: Random Banner Problem <WS010@dvvlap.be>
Re: Relational Searching <jdporter@min.net>
Re: Sharing a constant between scripts <jdf@pobox.com>
Re: Sharing a constant between scripts (Andrew M. Langmead)
Re: substituting text in a var (beginner question) <barry@megaspace.com>
substitution question <barry@megaspace.com>
Re: substitution question <jdf@pobox.com>
Re: Win::ODBC, Using "GROUP BY" SQL to output webmistress@chicweb.com
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 10 Apr 1998 14:47:25 +0200
From: Marcus Kramer <10707.3645@compuserve.com>
Subject: [Fwd: Variable in reguldren Ausdr|cken]
Message-Id: <352E14DD.F9AD6466@compuserve.com>
Dies ist eine mehrteilige Nachricht im MIME-Format.
--------------1B4B9B48B938AB9D83229039
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
--------------1B4B9B48B938AB9D83229039
Content-Type: message/rfc822
Content-Transfer-Encoding: 8bit
Content-Disposition: inline
Message-ID: <352E11E8.DCBCB58D@compuserve.com>
Date: Fri, 10 Apr 1998 14:34:48 +0200
From: Marcus Kramer <10707.3645@compuserve.com>
X-Mozilla-Draft-Info: internal/draft; vcard=0; receipt=0; uuencode=0; html=1; linewidth=0
X-Mailer: Mozilla 4.03 [de] (WinNT; I)
MIME-Version: 1.0
Newsgroups: de.comp.lang.perl
Subject: Variable in reguldren Ausdr|cken
Content-Type: multipart/alternative; boundary="------------1F5C7BD9F38F377579874A12"
--------------1F5C7BD9F38F377579874A12
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Hallo,
Ich stehe vor einem Problem, f|r das ich nirgendwo eine Lvsung finden
kann. Deswegen hoffe ich hier ein paar Tips zu bekommen.
Ich mvchte Textdateien filtern bzw. konvertieren mit einer Textdatei in
der sich eine Liste von Filtern befindet. Dazu lese ich den
Filter-String ein und teile ihn in $IFilter[0] - suchen nach und
$IFilter[1] - ersetzen durch. Das funktioniert aber nur, solange ich auf
der "ersetzen Seite" kein $1 verwende.
while (<FILTER>)
{
@IFilter = split(/\t/);
while (<ROHTEXT>)
{
$text =~ s/$IFilter[0]/${IFilter[1]}/g;
print AUSGABE $text;
}
}
Beispiel:
$IFilter[0] = "[zZ]\. *[bB]\.";
$IFilter[1] = "z. B.";
-> funktioniert
aber:
$IFilter[0] = "([zZ]\.) *([bB]\.)";
$IFilter[1] = "$1$2";
--> ergibt immer den String "$1$2" statt "z.B."
Gibt es |berhaupt eine Mvglichkeit das bei der Verwendung von Variablen
in reguldren Ausdr|cken der Wert der Variable wieder als Variable
erkannt wird und nicht als String???
Hoffentlich habe ich mich nicht zu unklar ausgedr|ckt und irgendjemand
kann damit etwas anfangen. Ich wdre dankbar f|r jeden Tip.
--------
Marcus Kramer
--------------1F5C7BD9F38F377579874A12
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<HTML>
Hallo,
<P>Ich stehe vor einem Problem, für das ich nirgendwo eine Lösung
finden kann. Deswegen hoffe ich hier ein paar Tips zu bekommen.
<P>Ich möchte Textdateien filtern bzw. konvertieren mit einer Textdatei
in der sich eine Liste von Filtern befindet. Dazu lese ich den Filter-String
ein und teile ihn in $IFilter[0] - suchen nach und $IFilter[1] - ersetzen
durch. Das funktioniert aber nur, solange ich auf der "ersetzen Seite"
kein $1 verwende.
<P><I>while (<FILTER>)</I>
<BR><I>{</I>
<BR><I> @IFilter = split(/\t/);</I>
<P><I> while (<ROHTEXT>)</I>
<BR><I> {</I>
<BR><I> $text =~ s/$IFilter[0]/${IFilter[1]}/g;</I>
<BR><I> print AUSGABE $text;</I>
<BR><I> }</I>
<BR><I>}</I>
<P><B>Beispiel</B>:
<BR>$IFilter[0] = "[zZ]\. *[bB]\.";
<BR>$IFilter[1] = "z. B.";
<BR>-> funktioniert
<P><B>aber:</B>
<BR>$IFilter[0] = "([zZ]\.) *([bB]\.)";
<BR>$IFilter[1] = "$1$2";
<BR>--> ergibt immer den String "$1$2" statt "z.B."
<P>Gibt es überhaupt eine Möglichkeit das bei der Verwendung
von Variablen in regulären Ausdrücken der Wert der Variable wieder
als Variable erkannt wird und nicht als String???
<P>Hoffentlich habe ich mich nicht zu unklar ausgedrückt und irgendjemand
kann damit etwas anfangen. Ich wäre dankbar für jeden Tip.
<P>--------
<BR>Marcus Kramer
<BR>
<BR>
<BR>
<BR> </HTML>
--------------1F5C7BD9F38F377579874A12--
--------------1B4B9B48B938AB9D83229039--
------------------------------
Date: 10 Apr 1998 14:36:54 GMT
From: ronaldws@aol.com (RonaldWS)
Subject: ANNOUNCE: IPC open2/open3 emulation module for Win32
Message-Id: <1998041014365401.KAA20024@ladder03.news.aol.com>
I have recently prepared a release of a module that emulates the functionality
of the functions open2 and open3 of the IPC module for ActiveState Perl 5.003
under Windows '95 and NT 4.0. These functions allow one program to run
another, feed input to the child program on the child program's standard input,
and read the childs standard and error output. To insure feedback for QC
purposes I am asking interested parties to send email to RonaldWS@aol.com for a
copy of this software.
Ronald Schmidt
------------------------------
Date: 10 Apr 1998 09:21:31 -0400
From: Russell Nelson <nelson@crynwr.com>
Subject: Re: Bill Gates should be invited to O'Reilly's "Free Software Summit" (was Re: RMS should be invited to O'Reilly's "Free Software Summit")
Message-Id: <m27m4x7qxw.fsf@desk.crynwr.com>
Russ Allbery <rra@stanford.edu> writes:
> In gnu.misc.discuss, Quentin Fennessy <quentin.fennessy@amd.com> writes:
>
> > About 60,000 lines of docs. Free. Despite the existence of O'Reilly
> > Perl books.
>
> And furthermore, most of the documentation that comes with Perl was
> written by the same people who wrote the books. Imagine that. And in
> many cases, it's better and more complete.
And people still buy the books. I have three Perl books in my office.
--
-russ <nelson@crynwr.com> http://web.crynwr.com/~nelson
Crynwr supports Open Source(tm) Software| PGPok | Freedom is the primary
521 Pleasant Valley Rd. | +1 315 268 1925 voice | cause of Peace, Love,
Potsdam, NY 13676-3213 | +1 315 268 9201 FAX | Truth and Justice.
------------------------------
Date: 10 Apr 1998 13:09:47 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Can somebody help me understand the internals of "Carp"?
Message-Id: <6gl5mr$gc4$1@lyra.csx.cam.ac.uk>
Vladimir Alexiev <vladimir@cs.ualberta.ca> wrote:
>Andy Wardley writes:
> if (ref $_) {
> # dunno what this is for...
> $_ .= '';
> s/'/\\'/g;
> }
>Conversion to string, ie basically the same thing as $_ = "$_".
>If $_ was a ref blessed into Foo then it will look like
>Foo=HASH(0x1234). I don't see how it can contain a ' unless the class
>overloads the '""' method.
Class names can be arbitrary strings. So you can do things like
bless $ref, "'";
if you're sufficiently perverse.
Mike Guy
------------------------------
Date: Fri, 10 Apr 1998 10:07:41 -0500
From: Chocolate <poohba@io.com>
Subject: Can someone give me an example of rounding!
Message-Id: <Pine.BSI.3.96.980410100551.16994A-100000@pentagon.io.com>
I don't nor will I have access to the web for about a week or two so I
would really appreciate it if someone would tell me how to round to 2
decimal point. I don't know how much different it will be but I am not
too familiar with perl5.
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/_/_/ _/ _/
_/ _/ _/ _/
Web Page Designs _/_/_/ _/_/_/ _/_/_/ _/_/_/ _/_/_/ _/_/_/
Small Programs _/ _/ / _/ _/ _/ _/ _/ _/ _/ _/ poohba@io.com
www.io.com/~poohba _/ _/_/_/ _/_/_/ _/ _/ _/_/_/ _/_/\_ (919)506-5883
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
------------------------------
Date: 10 Apr 1998 14:29:28 GMT
From: mist@yoyo.cc.monash.edu.au (Michael Stillwell)
Subject: Clunky Perl Prose
Message-Id: <slrn6isb67.kkf.mist@fangorn.cs.monash.edu.au>
If there's "more than one way to do it", what are the alternatives to
these:
1. Creating a reference to a list or hash returned by a function.
I currently do
# $foo == [ ];
@{$foo} = split(' ', $blah);
or
my @bar = split(' ', $blah);
$foo = \@bar;
But I'd like to do it in one step, and not the first way, which
looks odd in the middle of a couple of assignments where the
other right hand sides are references.
2. Creating a copy of an object. I do it with "$copy =
eval(Dumper($self))" with Deepcopy set to one, but there's got to
be a better way.
3. Removing some elements from a list. I generally do something like
my $n = 0;
while ($n < @list) {
if (...) { # some expression involving $list[$n]
... # e.g. move $list[$n] somewhere
splice(@list, $n, 1);
} else {
$n++;
}
}
But this is rather more complicated than the foreach
construction.
I suppose I could do something like
@list = grep {
...
} @list;
But it has an unusual syntax (I like my maps and greps to fit on
one line), the body requires some thinking about, and if the body
is large, it's hard to work out what list the grep is operating
on. Is it also less efficient than the while loop above?
(Because a copy of the list has to be built.)
Michael
--
.. ABSOLUT .SIG. ..
.. Michael Stillwell ..
.. mist@yoyo.cc.monash.edu.au ..
.. http://yoyo.cc.monash.edu.au/~mist/ ..
------------------------------
Date: Fri, 10 Apr 1998 15:12:03 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Geoffrey Hebert <soccer@all-soccer.com>
Subject: Re: Easy package/sub-routine ?
Message-Id: <Pine.GSO.3.96.980410080809.9100o-100000@user2.teleport.com>
On Fri, 10 Apr 1998, Geoffrey Hebert wrote:
> Easy package/sub-routine question. I want to put some sub-routines in a
> file to be used by several scripts.
So, you want to make a module (or maybe a library). A package, as the term
is used in Perl, is used in making libraries and modules, but it (in
itself) is not a way of "packaging" up code and data to be shared.
The info on making modules is in the perlmod manpage.
> Illegal character \015 (carriage return) at Testlib.pm line 2.
> (Maybe you didn't strip carriage returns after a network transfer?)
That sounds as if you didn't strip carriage returns after a network
transfer. :-) See what perldiag has to say about this.
Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 10 Apr 1998 09:15:26 -0500
From: sonny <sonny@88net.net>
Subject: General Rudeness, e.g. Re: Need a web login script
Message-Id: <352E297E.D83CC086@88net.net>
Do you think that being rude to people who post questions that you deem
aren't worthy will deter others from doing so? All this invective just adds
to the general noise. Ignore them, tell them to RTFM, or give'm an URL, but
this "its my playground" attitude is really childish.
sonny
Abigail wrote:
> David Schwab (dschwab@wolfe.net) wrote on MDCLXXXII September MCMXCIII in
> <URL: news:352C9571.FD3BAB78@wolfe.net>:
> ++ Yes I need a weblogin script that allows people to pass a login and
> ++ password thru a prompt and then have another way for an admin to add
> ++ users and remove something like .Htaccess please help if you can.
>
> So, what's your Perl question?
>
> This group is not about the web, nor is it a gimme, gimme, gimme group.
>
> Abigail
> --
> perl -wle 'print "Prime" if (0 x shift) !~ m 0^\0?$|^(\0\0+?)\1+$0'
------------------------------
Date: 10 Apr 1998 15:00:04 GMT
From: jhunterj@lexis-nexis.com (Hunter Johnson)
Subject: Re: help with delimiters
Message-Id: <6glc5k$rq7@mailgate.lexis-nexis.com>
[Posted and mailed.]
In article <6gk2nq$bhg@nntp1.erinet.com>,
Nick Bradaschia <cyborg@eri.erinet.com> wrote:
> I am stuck! (and a newbie too!)
> I am trying to read just a certain data from a file.
> from the string:
> log:name:connect:transmit:receive:protocol
> I want to obtain only the "connect" value
> ($rx)=split((':'),$line);
> this is what i think it's doing: i open the file, set $line to read
> every line from the file <DATA> set $rx to equal everything bounded
> before the first ":". right?
Right.
> how can I set the delimiter so it reads the xth ":" instead of the
> 1st one? Any help is appreciated!!
split returns a list, and you can just use subscripts on it like any
other list, in this case:
$rx = (split(':', $line))[2];
HTH,
Hunter
--
J. Hunter Johnson | "A little consistent wholesome modeling and
jhunterj@lexis-nexis.com | costly servanthood are worth millions of
(937) 865-6800 x5385 | true words harshly spoken."
Lexis-Nexis, Dayton, OH | -- Ron Sider
------------------------------
Date: Fri, 10 Apr 1998 10:02:29 -0500
From: James Ludlow <ludlow@us.ibm.com>
Subject: Re: help with delimiters
Message-Id: <352E3485.BAC4ABD9@us.ibm.com>
Nick Bradaschia wrote:
>
> I am stuck! (and a newbie too!)
> I am trying to read just a certain data from a file.
> i.e.
> from the string:
> log:name:connect:transmit:receive:protocol
> I want to obtain only the "connect" value (which happens to be bounded by 2
> ":"'s). I have attempted to do a split
> procedure, but it does not appear to work!
> here is my code:
>
> open (DATA, "data");
It's common practice to always check the return values of an open...
open (DATA, "data") or die "Couldn't open data $!";
> while ($line=<DATA>) {
> ($rx)=split((':'),$line);
^^^^^
You're actually pretty close. The return value of split is a list (an
array). You are assigning this list to the list ($rx), which only
stores the first value passed to it. The other values from the split
are there, but you're effectively throwing them away. You could
accomplish your goals in a couple different ways.
($log,$name,$connect,$transmit,$receive,$protocol) = split /:/, $line;
- OR -
$connect = (split /:/, $list)[2];
Items to read about in the docs/faqs:
split
slice
list
scalar
array
--
James Ludlow (ludlow@us.ibm.com)
This isn't tech support, and all opinions are my own.
------------------------------
Date: Fri, 10 Apr 1998 15:28:21 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Jeff <jn1@outofservice.com>
Subject: Re: Looking for Polling/Voting CGI/java Script
Message-Id: <Pine.GSO.3.96.980410082717.9100r-100000@user2.teleport.com>
On Fri, 10 Apr 1998, Jeff wrote:
> what i've done (look at www.outofservice.com) is just track ip's. sure,
> someone can reconnect with a different IP and vote again... but that'd
> be work. it stops the not-so-serious ones.
It also stops most users of services which use proxies. :-P
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 10 Apr 1998 15:42:32 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: bjf <ben@wallroyds.demon.co.uk>
Subject: Re: May can you help, please?
Message-Id: <Pine.GSO.3.96.980410083046.9100s-100000@user2.teleport.com>
On Fri, 10 Apr 1998, bjf wrote:
> Subject: May can you help, please?
Please check out this helpful information on choosing good subject
lines. It will be a big help to you in making it more likely that your
requests will be answered.
http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post
> All I need the code to do is, to see if the URL is out there or not.
Sounds as if you want to verify a URL. Just one, of a set of them? Maybe
you want LWP.
> But, this code doesn't work
"Doesn't work" is a little vague. Does it give an error message? Does it
give no output? Does it give the wrong output? Does it give too much
output? Too little? Does it make smoke come out of the computer? Does it
hang, dump core, or make the monitor jumpy? We need just a little more
information.
> #!/usr/local/bin/perl
When your code doesn't work, you should ask Perl to help you with the -w
option. In fact, most people recomment using -w during all of the
development phase, at least. Then perl will warn you if it sees anything
suspicious happening...
> $theurl = qw(http://www.yahoo.com/index.html);
...like that. Don't use qw() in a scalar context! You probably wanted to
use q() instead.
> if (PING $theurl) {
Perl doesn't have a built-in PING function. And you can ping a machine,
not a URL. I think you want to use LWP.
> sub PING
>
> $_[0] =~ m!^(http):!;
> }
Hmmm. Well. No, I think that that code is not what you want.
You can find LWP on CPAN. You can find the Llama book at any good
bookstore. Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 10 Apr 1998 09:27:13 -0400
From: Jerome Bradenbaugh <jerome.bradenbaugh@firstunion.com>
Subject: Multi-dimensional Array Access
Message-Id: <352E1E31.70B7@firstunion.com>
Dear Readers:
Accessing the last element of a single-dimension array is pretty
straightforward:
@stuff = qw(monday tuesday wednesday thursday friday);
$stuff[$#stuff] represents the last element (friday in this case).
However, consider the following multi-dimensioanl array:
@morestuff = ([1,2,3,4], [5,6,7,8], [9,10,11,12]);
Does anyone know the syntax for accessing the last element of each of
the sub arrays (in this case, the 4, 8, or 12)?
Please post or kindly respond to the address listed below. Thanks in
advance.
Jerry Bradenbaugh
First Union National Bank
------------------------------
Date: 10 Apr 1998 10:15:14 -0500
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: Multi-dimensional Array Access
Message-Id: <n2dtwvwd.fsf@mailhost.panix.com>
Jerome Bradenbaugh <jerome.bradenbaugh@firstunion.com> writes:
> @morestuff = ([1,2,3,4], [5,6,7,8], [9,10,11,12]);
>
> Does anyone know the syntax for accessing the last element of each of
> the sub arrays (in this case, the 4, 8, or 12)?
One rather compressed way:
print "$r->[-1]\n" while $r = shift @morestuff;
Of course, that eats @morestuff. You could therefore
foreach $r (@morestuff) { print "$r->[-1]\n" }
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
------------------------------
Date: Fri, 10 Apr 1998 15:52:35 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: blr@mail.alarmix.net
Subject: Re: New error? I can't open a file to write!
Message-Id: <Pine.GSO.3.96.980410084249.9100t-100000@user2.teleport.com>
On Fri, 10 Apr 1998 blr@mail.alarmix.net wrote:
> I'd like to create a file, but I can't. Here is the 2 line from one of my
> CGI-script:
>
> open(TCF,">$HOMEDIR/var/$tcf") || warn "Can't create $tcf.";
That's good that you're checking the return value from open. But you
probably want to do two more things: Include the magical $! variable in
the error message (so that you'll find out why the open failed) and make
sure that the error message comes back to you somehow (so you can read
it). That last can be a problem in scripts which aren't run interactively,
such as CGI scripts.
I'd probably write the error check something like this:
open TCF, ">$HOMEDIR/var/$tcf"
or die "Can't open '$HOMEDIR/var/$tcf' for write: $!";
That tells me exactly which file it was, and which operation. Also, I use
die instead of warn, since I almost never want to continue if a file can't
be created.
As for seeing the die message, there are other ways to do this, but for
debugging, I sometimes put something like this near the top of a script.
# Remove this block when done debugging!
BEGIN {
local($|) = 1; # Temporarily turn off buffering
print "Content-type: text/plain\n\n";
my $date = localtime;
print "Script $0\nrunning on $date (Perl version $])\n\n";
unless (open STDERR, ">&STDOUT") {
print "Can't redirect STDERR: $!";
exit;
}
print "\n";
}
Now you should be able to see any error messages (and everything else)
produced by your script, right on your browser.
Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 10 Apr 1998 10:06:48 -0400
From: plussier@baynetworks.com (Paul L. Lussier)
Subject: Perl and procmail
Message-Id: <h67yaxdydmv.fsf@baynetworks.com>
Hi all. I was wondering how to go about combining a perl mail filter
with a procmail recipe. What I want to do is use a perl mail filter
script to expand the capabilities of procmail. For instance, if either
or both of the To: and Cc: lines contain more than say 6 addresses and the
e-mail is internally generated, send an auto-reply to the originator of the
e-mail, otherwise pass through to the rest of the procmail recipes.
I figure using perl with Graham's Mail modules should make looking at the
header lines pretty trivial. What I can't figure out is how, if the header
lines don't match my criteria, to get the e-mail to pass back into the
.procmailrc file from where it left off.
Does any one have any ideas on this?
Thanks.
--
Seeya,
Paul
------------------------------
Date: Fri, 10 Apr 1998 15:25:54 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Devjyoti Mookerjee <devjyoti@123greetings.com>
Subject: Re: PERL SUBROUTINES....
Message-Id: <Pine.GSO.3.96.980410082014.9100q-100000@user2.teleport.com>
On Fri, 10 Apr 1998, Devjyoti Mookerjee wrote:
> Subject: PERL SUBROUTINES....
Please check out this helpful information on choosing good subject
lines. It will be a big help to you in making it more likely that your
requests will be answered.
http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post
> Can you please tell me if there is any way a subroutine can be called
> directly from outside a script, as from the prompt, or as an URL?
There's no real way of invoking just a subroutine from a Perl script and
no other code. But you can write a script so that it will call the
subroutine of your choice, of course - in Perl, or in pretty much any
other language. Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 10 Apr 1998 06:18:52 -0700
From: "Creede Lambard" <$_=qq!fearless\@NOSPAMio.com!;y/A-Z//d;print>
Subject: Re: perl win 32 : asterisk on command line
Message-Id: <6gl67v$6e1@bgtnsc02.worldnet.att.net>
Ah. Well, I've been wrong before and lived to admit it. I guess the last
time I did something like this it was more like
for %1 in (*) do perl -pi.bak -e "s/fzortni/smargnod/g" %1
--- Creede Lambard
Minister of Irregular Expressions
Programming Republic of Perl
Michael Kairys wrote in message <352cddb4.0@news.ic.net>...
>
>>-p means "loop through all of the lines in the specified file." (Like
>>the -pi.bak we see in all those oneliners.) You're specifying "*", which
to
>>Win32 is the wildcard matching all filenames in a directory. So, Perl
>>apparently thinks you want it to run through whatever directory you happen
>>to be in and do somescript.pl to all of them.
>
>
>Nope. Note the original command:
>
>>>problem: perl -w somescript.pl -l thisarg -p * -u thatarg
>
>The -p switch comes *after* the script file, and as such is handled by the
>script, not Perl. Example:
>
>In any case Perl does not behave as you hyothesize. Examples:
>
>> perl -w -p * somescript.pl
>Can't open perl script "*": Invalid argument
>
>
------------------------------
Date: Fri, 10 Apr 1998 15:04:28 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Hello570 <hello570@aol.com>
Subject: Re: problem printing long line to file
Message-Id: <Pine.GSO.3.96.980410075638.9100n-100000@user2.teleport.com>
On 10 Apr 1998, Hello570 wrote:
> I tried printing a line to a file using both of the
> following methods, but the output was split into two lines. Is there a
> way to force the string to be printed all on one line?
Sure: Just print only one line! :-)
Unlike some programming languages, Perl will not add newlines to your
output (unless you tell it to do so).
> print PROJFILE <<WWW;
> <!-- xxxxxxxxxxr --><LI>xxxxxxxxxxxr:<a
> href=\"mailto:$p_xxxx_coord_email\">*$p_xxxxxxxx_coord_name</a>*$p_xxxxxx_
> coord_phone\n
> WWW
I see some "true" newlines and even a "\n" in there. Of course, it's hard
to make a here-doc without at least one newline! If your text editor
doesn't let you easily make long lines, though, you could use this
strategy.
my $temp = <<"END_MARK";
whatever you need
goes here
END_MARK
$temp =~ tr/\n/ /; # Or something similar
print OUT $temp;
Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 10 Apr 1998 13:15:51 GMT
From: "WS010" <WS010@dvvlap.be>
Subject: Re: Random Banner Problem
Message-Id: <01bd6483$bcffdc60$8c7479c1@dvvbeint0ws010>
Jeremy,
<img src="MyScript.cgi">: nobody is going to stop you if you
write that, but it won't make happen what you want.
How about aliasing the URL of that page by a CGI script; when the
web client requests your URL it causes execution of that script at
the server.
How about storing the names of your image files in an array,
and use the rand function to compute an index at random?
This would involve the page content being generated by your
cgi script.
Hope that is of any help.
Jos Snellings, (Jos.Snellings@1cd4u.com).
------------------------------
Date: Fri, 10 Apr 1998 13:15:12 GMT
From: John Porter <jdporter@min.net>
Subject: Re: Relational Searching
Message-Id: <352E1CD0.69A2@min.net>
Henry Lifton wrote:
>
> I have done searching in flat file databases before, but now I have a database
> with 2 tables with a one to many relationship.
>
> I need to search on 1 field in one and on 3 fields in the other, then the
> records that match those fields will be displayed.
You haven't said that the two tables are related.
>From your description, why don't you just do the "single-table" search
of the two tables, separately?
Assuming the tables are related, it gets a little harder.
How are they related? I don't think you mean to join them by the
one field / three fields... So do you have another join key in mind?
In any case, you should use hashes for the actual searches, for
simplicity of code and reasonably good performance.
If you're joining on one field, I would do this:
create a hash from the table with more rows, such that the keys
are the values of the join field, and the values of the hash
are references to the entire row. The iterate through the join field
values from the other table, looking up the values in the hash you
made. If there's a match, you get the ref to the row you need.
If the tables are very large, you can optimize a little bit by
creating hashes of values from both tables, and, using the hashes
as sets, find the set intersection, before performing the
cartesian product for each common value. You can optimize even
further if you know that the values of the join field are
unique.
hth,
John Porter
table,
------------------------------
Date: 10 Apr 1998 09:56:11 -0500
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: Sharing a constant between scripts
Message-Id: <ogy9wws4.fsf@mailhost.panix.com>
kpreid@ibm.net (Kevin Reid) writes:
> First of all, write your constants like this, so that Perl will optimize
> them into "true" constants:
>
> sub Constant1 () {'rsgoheen@pobox.com'}
Kevin's advice is good. There is, however, a pseudo-module that does
it for you:
use constant AUTHOR => 'rsgoheen@pobox.com';
Please note that, as a matter of style, I spell my constants in all
caps. Since scalar constants are currently implemeneted as inline
functions, using caps has the benefit of avoiding conflicts with
perl's operator names. The constant pragma is package-scoped.
#!/c/perl/bin/perl -w
package foo;
use constant FOO => 'bar';
package main;
print foo::FOO, "\n";
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
------------------------------
Date: Fri, 10 Apr 1998 14:41:02 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Sharing a constant between scripts
Message-Id: <Er7CsF.Mun@world.std.com>
Robert Goheen <rsgoheen@pobox.com> writes:
>package myConstants;
>sub new {
> my $self = {};
> bless $self;
>}
Don't confuse modules with object oriented programming. Is there are
reason that you need to make an object to hold your constants?
package myConstants;
require Exporter;
@ISA=qw(Exporter);
@EXPORT=qw(Constant1 Constant2);
use constant Constant1 => 'rsgoheen@pobox.com';
use constant Constant2 => 'Robert Goheen';
--
Andrew Langmead
------------------------------
Date: Fri, 10 Apr 1998 10:09:12 -0400
From: "Barry Kaplan" <barry@megaspace.com>
Subject: Re: substituting text in a var (beginner question)
Message-Id: <01bd648a$894978c0$d5c7aec7@bazzle>
you have $hiddenreferrer defined as a literal string (everything inside the
quotes) and that is exactly what is showing up in your html.
try this instead:
$hiddenreferrer="<INPUT TYPE=\"hidden\" NAME=\"myreferrer\" VALUE=\
"",$referer,"\">";
>
> Then, in my template file, I place:
>
> $hiddenreferrer
>
> When I view the HTML source it writes:
>
> <INPUT TYPE="hidden" NAME=myreferrer" VALUE="$myreferrer">
<INPUT TYPE="hidden" NAME=myreferrer" VALUE="http://domain.com/file.html">
jf@medianook.com wrote in article <6gj6h3$qk1$1@nnrp1.dejanews.com>...
> Hi,
>
> I'm new to Perl and have one quick problem with a program. In the
program, I
> am establishing the following variables:
>
> ###
> $referer=$ENV{"HTTP_REFERER"};
> $hiddenreferrer="<INPUT TYPE=\"hidden\" NAME=\"myreferrer\" VALUE=\
> "$myreferer\">";
> ###
>
> Then, in my template file, I place:
>
> $hiddenreferrer
>
> When I view the HTML source it writes:
>
> <INPUT TYPE="hidden" NAME=myreferrer" VALUE="$myreferrer">
>
> What it should read is:
>
> <INPUT TYPE="hidden" NAME=myreferrer"
VALUE="http://domain.com/file.html">
>
> It looks like Perl is resolving it almost correctly. Am I not escaping it
> correctly to write the full referrer?
>
> Thank you.
>
> Jay
> jf@medianook.com
>
>
>
>
> ---
> Look, if it weren't for the massive firewall here, I wouldn't have to use
this
> service. Please, ignore the following unnecessary advertising...
>
> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> http://www.dejanews.com/ Now offering spam-free web-based newsreading
>
------------------------------
Date: Fri, 10 Apr 1998 10:12:19 -0400
From: "Barry Kaplan" <barry@megaspace.com>
Subject: substitution question
Message-Id: <01bd648a$f96a4e40$d5c7aec7@bazzle>
Is there a way to take instances of repeating text such as:
Embedded RoutersEmbedded RoutersEmbedded Routers
and substitute out the redundancies?
------------------------------
Date: 10 Apr 1998 11:08:53 -0500
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: substitution question
Message-Id: <ogy9mzfu.fsf@mailhost.panix.com>
"Barry Kaplan" <barry@megaspace.com> writes:
> Is there a way to take instances of repeating text such as:
> Embedded RoutersEmbedded RoutersEmbedded Routers
> and substitute out the redundancies?
Here's a solution that kills repetitions of phrases that are two
letters long or longer. Note that it's not *particularly* efficient
(read: it's horribly inefficient) and that sometimes it gives bad
results (if, say, the string "that's a beeeeg gun, meester" appears in
your input; "beeeeg" will become "beeg," and you'll have a slightly
less impressive weapon). But it probably answers your question. Now,
go and read perlre, perlop, and perlfaq6.
#!/c/perl/bin/perl -w
$_ = "I'll have some peanut butterpeanut butterpeanut butter.\n";
1 while s/(.{2,})\1/$1/g;
print;
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
------------------------------
Date: Fri, 10 Apr 1998 09:52:09 -0600
From: webmistress@chicweb.com
Subject: Re: Win::ODBC, Using "GROUP BY" SQL to output
Message-Id: <6glbmp$dq4$1@nnrp1.dejanews.com>
In article <352ADCDA.CB7B119F@spider.herston.uq.edu.au>, Jaime Metcher
<metcher@spider.herston.uq.edu.au> wrote:
> <<a whole bunch of really useful
code to solve my problem>>
Thanks a bunch, Jaime. I will work on it using
your ideas. I was getting the idea that there wasn't an "easy" way and that I
would, indeed, have to check for the unique names manually.
See the diff
between this and Cold Fusion is that CF does this for you, so you can be
really really lazy and write hardly any code. All I do in CF is say <output
query="queryname" group="whatIwanttogroupby"></output> and it's done! Pretty
convenient for a lazy programmer.
So <sigh> I will chain my ankle back to
the desk and get cracking. Again, thanks.
Regards,
Laura
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.
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 2290
**************************************