[11589] in Perl-Users-Digest
Perl-Users Digest, Issue: 5189 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Mar 21 02:07:23 1999
Date: Sat, 20 Mar 99 23:00:18 -0800
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, 20 Mar 1999 Volume: 8 Number: 5189
Today's topics:
Re: 9-3748fh*42-06815.831.2an (Larry Rosler)
Re: About CGI.pm <fty@utk.edu>
Re: access to unparse command line (Abigail)
attaching email files billy_collins@my-dejanews.com
Re: dir command in perl? (Larry Rosler)
Re: Forwarding to home directory using Net::FTP <rmcvay@acm.org>
Re: getting keys of hashes of hashes (Larry Rosler)
Re: inserting large numbers into databases (Larry Rosler)
Re: newbie - counting words <ebohlman@netcom.com>
Re: newbie - counting words <gwynne@utkux.utk.edu>
pb with XS and a arch AND perl5-version installation <bouteille@dial.oleane.com>
Re: Perl scripts written for UNIX. Will they work on NT (Larry Rosler)
Re: Print to browser before end of script (George Crissman)
Re: Print to browser before end of script (George Crissman)
Re: Q: format and write (Larry Rosler)
Re: Q: How do i? ramzes@my-dejanews.com
Re: Q: opening multiple filehandles concurrently? (Larry Rosler)
Re: Regex Question (Abigail)
Sending Mail Though SMTP <mfoster@spots.ab.ca>
Re: Simple perl question (Larry Rosler)
Simple Subset Question <gwynne@utkux.utk.edu>
Re: Simple Subset Question <rra@stanford.edu>
Re: Substitution question (Larry Rosler)
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 19 Mar 1999 15:34:27 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: 9-3748fh*42-06815.831.2an
Message-Id: <MPG.115c7edae83d6450989793@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <x7u2vhaxtg.fsf@home.sysarch.com> on 19 Mar 1999 18:01:31 -
0500, Uri Guttman <uri@home.sysarch.com> says...
> >>>>> "LR" == Larry Rosler <lr@hpl.hp.com> writes:
> LR> In article <10N6uy-0005aZ-00@drule.org> on 17 Mar 1999 03:22:56 -0000,
> LR> Anonymous <Use-Author-Address-Header@[127.1] >says...
>
> LR> <SNIP 1551 lines of bullshit>
>
> watch your tongue larry, there may be kids reading these groups! :-)
Actually, it was an over-reaction. See below.
> LR> What did the Perl newsgroup do to deserve this punishment? Please tell
> LR> us, lest we sin again and be punished again.
>
> which is why i skipped it. 1500 lines in a perl group means ignore!
Sheepish admission -- I saved it (as 'bullshit.txt' :-), and have been
reading it from time to time. It is very amusing; erudite but quite
wrong-headed IMO. As the wrong-headedness has a religious basis, I'd
better say no more.
Even though there is a lot of math in it, I still don't know why the
Perl group was addressed.
--
Larry Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 17 Mar 1999 20:26:26 -0500
From: Jay Flaherty <fty@utk.edu>
Subject: Re: About CGI.pm
Message-Id: <36F05642.DF9FE82E@utk.edu>
Kent Wang wrote:
>
> Just how efficient is CGI.pm? Are there alternatives? What's up with
> LWP?
CGI.pm used to be pretty slow but now that it uses the Perl autoloader
to defer the loading of non-essential sub-routines till they are needed
it loads ands runs very fast (milliseconds). Use this in conjunction
with mod_perl and you can autoload CGI.pm when Apache starts up with a
startup script and a PerlScript directive in httpd.conf. This is all
explained in Lincoln Stein's book on the CGI.pm module.
Take care of your shoes...jay
------------------------------
Date: 21 Mar 1999 05:38:50 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: access to unparse command line
Message-Id: <7d20la$ftc$1@client2.news.psi.net>
kk (kk) wrote on MMXXVIII September MCMXCIII in
<URL:news:36f44048@news3.us.ibm.net>:
&& Anyone know of way to access the unparsed command line arguments (something
&& instead of @ARGV)?
What's wrong with @ARGV?
Abigail
--
sub _'_{$_'_=~s/$a/$_/}map{$$_=$Z++}Y,a..z,A..X;*{($_::_=sprintf+q=%X==>"$A$Y".
"$b$r$T$u")=~s~0~O~g;map+_::_,U=>T=>L=>$Z;$_::_}=*_;sub _{print+/.*::(.*)/s}
*_'_=*{chr($b*$e)};*__=*{chr(1<<$e)};
_::_(r(e(k(c(a(H(__(l(r(e(P(__(r(e(h(t(o(n(a(__(t(us(J())))))))))))))))))))))))
------------------------------
Date: Sun, 21 Mar 1999 06:37:46 GMT
From: billy_collins@my-dejanews.com
Subject: attaching email files
Message-Id: <7d243q$pp1$1@nnrp1.dejanews.com>
Hi,
Will appreciate if someone could tell me if there is a freely available script
for the following, or if not, then what modules would come in handy:
I need to set a simple form, giving the user a facility to send a file as an
attachment to an email address. I think that to allow the user to select the
file to attach from his computer, I would need the MULTIPART form, but how to
send it as an attachment with the email?
Thanks for your time, please CC your reply to this post to me at:
queerczar@unforgettable.com.
Best regards,
Billy
____________________________________
Trails need to be wider so people can walk while holding hands.
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 19 Mar 1999 15:19:53 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: dir command in perl?
Message-Id: <MPG.115c7b6f3e5669ec989791@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <36F2CDB2.A024A42@earthlink.net> on Fri, 19 Mar 1999 14:20:34
-0800, josri <josri@earthlink.net> says...
> how can i run "dir" command with perl in windows?
>
> I tried
> $dir='dir';
That just assigns a constant string to $dir. Use back-ticks to execute
a command and capture its output.
$dir = `dir`;
But why not read about the functions opendir and readdir, and do it
yourself?
--
Larry Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Sun, 21 Mar 1999 06:01:41 GMT
From: Ray McVay <rmcvay@acm.org>
Subject: Re: Forwarding to home directory using Net::FTP
Message-Id: <36F486FB.C7C9416D@acm.org>
That sounds like a server config problem to me. The FTP server should
initially put you in the home dir of the login user.
"Kevin S (xS)" wrote:
>
> Hey,
>
> I have had success with Net::FTP on most ftps, yet for some reason it does
> not seem to work on ftps where your home directory is not the root dir.
> Unlike other ftp clients, Net::FTP does not automatically forward you there,
> and it does not seem to set a variable as to what the home dir is. I have
> read the FTP RFC's yet they didn't provide much help.
>
> Anyone who can show me perl code, or just the ftp command to use would be of
> extreme help.
>
> Thanks in advance,
>
> 'xS
> xs AT dmusic DOT com
--
Ray
+--------------------------------------------------+
+ I've gone to look for myself. If I should return +
+ before I get back, keep me here!! - Bill the Cat +
+--------------------------------------------------+
------------------------------
Date: Fri, 19 Mar 1999 14:46:40 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: getting keys of hashes of hashes
Message-Id: <MPG.115c73af6dffb88c989790@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <36F2CD4C.DEB51BD3@uci.edu> on Fri, 19 Mar 1999 14:19:08 -
0800, =?iso-8859-1?Q?d=E1na?= watanabe <dwatanab@uci.edu> says...
> I'm trying to be incredibly lazy and avoid declaring (or 'my'ing) variables
> for foreach statements by giving up on foreach altogether
> and just using for (which gives you $_ which is a lot less work to type anyway)
As 'for' and'foreach' are synonymous, it isn't clear what you mean by
this.
...
> for (keys %a) {
> for (keys %{$a{$_}}) {
> for (keys %{$a{???}{$_}}) { <--- what to do here?
> }
> }
> }
Unfortunately, there is only one $_ in this code; nothing is localized
to the inner loops (and if it were, how would you refer to the outer
loop iterators?). You have no choice but to declare an iterator for at
least two of the three loops.
--
Larry Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Fri, 19 Mar 1999 13:00:09 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: inserting large numbers into databases
Message-Id: <MPG.115c5ab21be4acae98978c@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <7cu3on$bfl$1@nnrp1.dejanews.com> on Fri, 19 Mar 1999
18:07:35 GMT, chortik@my-dejanews.com <chortik@my-dejanews.com> says...
> Is it possible to prevent perl from casting a 17 digit long string into a
> double before it is inserted into a database. the field in the database
> table is set to recieve a 17 character string, but perl casts it into a
> double, chopping off the least significat digit. is there a way around this?
Why would perl treat a string as a number, unless you tell it to?
my $string = '123456789.123456789';
print $string, "\n";
print $string + 0, "\n";
But maybe if you use "$string" at the critical place (with the double
quotes) everything will go well.
--
Larry Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Sun, 21 Mar 1999 03:58:03 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: newbie - counting words
Message-Id: <ebohlmanF8xF0r.B6v@netcom.com>
Rahul K <rahulk@iname.com> wrote:
: I have a list of words which look something like this:
: cat
: bat
: mat
: the
: run
: cat
: mat
: I want to find out the number of occurences of each word. How do I do
: that?
Build a hash whose keys are the words and whose values are the counts.
------------------------------
Date: Sat, 20 Mar 1999 23:54:36 -0500
From: "Robert Gwynne" <gwynne@utkux.utk.edu>
Subject: Re: newbie - counting words
Message-Id: <7d1u21$qah$1@gaia.ns.utk.edu>
See page 280 of the Perl Cookbook.
Bob
Rahul K <rahulk@iname.com> wrote in message
news:36F4075B.51185408@iname.com...
>
>Hi,
>
>I have a list of words which look something like this:
>
>cat
>bat
>mat
>the
>run
>cat
>mat
>
>
>I want to find out the number of occurences of each word. How do I do
>that?
>
>Thanks in advance,
>
>rahul
>
------------------------------
Date: 21 Mar 1999 07:22:29 +0100
From: Olivier Bouteille <bouteille@dial.oleane.com>
Subject: pb with XS and a arch AND perl5-version installation
Message-Id: <m3iubv7462.fsf@localhost.oleane.com>
I have a little pb with installing a XS extension to perl.
I have wrtitten a small XS module for perl that is arch dependent and
perl-version dependent.
On our network, we have to versions of Perl (5.004_04 and 5.005_02).
I have no unix rigth to install my module in the perl distribution.
If I install it in (for example) /net/tmp, I would like to make this
ionstallation arch demendant AND perl-version dependent. But, as a
default, the makefile (produced by a standard Makefile.PL) install it
jus arch dependent and not perl-version dependent.
I try to change LIB in the Makefile.PL to make it perl-version
dependant, but then the standard mecanism for using it does not work
any more. (use lib '/net/tmp/lib/perl5).
I do not understand why C<use lib '/net/tmp/lib/perl5'> does not
include a perl5-version dependent directory in C<@INC>, just like
there is in the standard @INC.
Thanx in advance for any body telling where I am wrong.
--
Olivier (bouteille@dial.oleane.com)
Nothing ever becomes real until it is experienced.
------------------------------
Date: Fri, 19 Mar 1999 14:01:17 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Perl scripts written for UNIX. Will they work on NT?
Message-Id: <MPG.115c6903f5d5f71498978f@nntp.hpl.hp.com>
In article <B3180DAC96689732BE@204.112.166.88> on Fri, 19 Mar 1999
14:20:28 -0600, Lee <rlb@intrinsix.ca> says...
> In article <MPG.1158625692c24991989764@nntp.hpl.hp.com>,
> lr@hpl.hp.com (Larry Rosler) wrote:
>
> >I seldom resort to this form of dialogue, but your opinion is indeed a
> >load of tripe, as you say in your pseudo-address.
>
> Really? This is the fifth post from you that I've read today, and I would
> have classified all of them as snarky and dismissive. Having a rough day?
None of my dictionaries contains 'snarky'. I presume it means 'in the
manner of a snark', and "...the Snark's a peculiar creature, that won't
Be caught in a commonplace way...". But some Snarks are Boojums, you
know.
Oh, well. Whether or not this post is snarky, I hope it is sufficiently
dismissive. Bye, bye!
--
Larry Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Sun, 21 Mar 1999 06:37:05 GMT
From: strads@tmisnet.com (George Crissman)
Subject: Re: Print to browser before end of script
Message-Id: <36f490d6.14017854@news2.tmisnet.com>
On Sat, 20 Mar 1999 17:22:48 -1000, "Mike Clark"
<super@super-mall.net> wrote:
>I am writing a script which receives values from a form, then passes the
>values to a number of command lines which execute a series of other programs
>in sequence.
>
>The whole process takes several minutes.
>
>After the viewer submits the form, I want the script to print to browser
>"thanks, please wait" or some message.
>
>But the script waits until all the processes are finished before it prints
>to browser, and the browser times out.
>
>I have tried several combinations, at the beginning of the script:
>
>{
>print( "STDOUT "Content-Type: text/html\n\n");
>print(STDOUT "thanks, please wait");
>}
>
>
>{
>print("Content-Type: text/html\n\n");
>print("thanks, please wait");
>}
>
>
>{
>print "Content-Type: text/html\n\n";
>print "thanks, please wait";
>}
>
>
>print "Content-Type: text/html\n\n";
>print "thanks, please wait";
>
>
>I have also tried putting the later commands into a subroutine.
>
>These all work by themselves.
>
>But when other command lines follow it, the script will not print to browser
>because the browser times out.
>
>The script does execute all the commands in sequence, however, so I know the
>script is functioning properly except for this glitch.
>
>
>Anybody got any answers?
>
>
>Thanks
>
>
>Mike Clark
>super@101super.com
>Tel/Fax 808 982 6463
>
>
>
>
-----------------------------------------------------------------------
"There is no need to criminalize millions of legitimate and responsible
businesses and individuals in order to stop a very small group of
irresponsible people, particularly when there are other ways already
working ." says Mr. Dan Hufnal of the (relatively small) 10,000 member
DEAA. What does he mean by "other ways already working"?
Maybe: <http://www.tmisnet.com/~strads/spamhunt/index.html>
-----------------------------------------------------------------------
------------------------------
Date: Sun, 21 Mar 1999 06:37:21 GMT
From: strads@tmisnet.com (George Crissman)
Subject: Re: Print to browser before end of script
Message-Id: <36f49110.14075803@news2.tmisnet.com>
Umm...
>print("Content-Type: text/html\n\n");
>print("thanks, please wait");
You need a bit more to print an HTML page ...
# Fussy Start-Up Code
print "Content-Type: text/html\n\n" ;
print "<HTML>" ;
# HTML Delay Page
print <<"Delay";
<HEAD>
<TITLE>Working!</TITLE>
</HEAD>
<BODY BGCOLOR="BLUE">
<H3 ALIGN="CENTER">Thanks! Please wait!</H3>
</BODY>
</HTML>
Delay
.... would be the bare minimum (well, okay, the H3 is an overkill!)
to display a web page. If you incorporate the missing code into
your CGI program, you'll probably be much more successful.
-- George Crissman
-- strads@tmisnet.com
As for getting the page sent before the other processes are
complete, I'll have to defer to someone more experienced.
Sorry!
On Sat, 20 Mar 1999 17:22:48 -1000, "Mike Clark"
<super@super-mall.net> wrote:
>I am writing a script which receives values from a form, then passes the
>values to a number of command lines which execute a series of other programs
>in sequence.
>
>The whole process takes several minutes.
>
>After the viewer submits the form, I want the script to print to browser
>"thanks, please wait" or some message.
>
>But the script waits until all the processes are finished before it prints
>to browser, and the browser times out.
>
>I have tried several combinations, at the beginning of the script:
>
>{
>print( "STDOUT "Content-Type: text/html\n\n");
>print(STDOUT "thanks, please wait");
>}
>
>
>{
>print("Content-Type: text/html\n\n");
>print("thanks, please wait");
>}
>
>
>{
>print "Content-Type: text/html\n\n";
>print "thanks, please wait";
>}
>
>
>print "Content-Type: text/html\n\n";
>print "thanks, please wait";
>
>
>I have also tried putting the later commands into a subroutine.
>
>These all work by themselves.
>
>But when other command lines follow it, the script will not print to browser
>because the browser times out.
>
>The script does execute all the commands in sequence, however, so I know the
>script is functioning properly except for this glitch.
>
>
>Anybody got any answers?
>
>
>Thanks
>
>
>Mike Clark
>super@101super.com
>Tel/Fax 808 982 6463
>
>
>
>
-----------------------------------------------------------------------
"There is no need to criminalize millions of legitimate and responsible
businesses and individuals in order to stop a very small group of
irresponsible people, particularly when there are other ways already
working ." says Mr. Dan Hufnal of the (relatively small) 10,000 member
DEAA. What does he mean by "other ways already working"?
Maybe: <http://www.tmisnet.com/~strads/spamhunt/index.html>
-----------------------------------------------------------------------
------------------------------
Date: Fri, 19 Mar 1999 15:23:55 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Q: format and write
Message-Id: <MPG.115c7c616ac57869989792@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <ebohlmanF8v5L0.J44@netcom.com> on Fri, 19 Mar 1999 22:38:59
GMT, Eric Bohlman <ebohlman@netcom.com> says...
> Thomas Ruedas <ruedas@geophysik.uni-frankfurt.de> wrote:
...
> : foreach (@srchstr) { $hits{$_}=0; }
>
> Unnecessary--hash elements get initialized to zero when created.
No, they don't get initialized when created. But you can increment them
(as you do below) without getting a warning, by special dispensation.
So you are right -- initialization is unnecessary.
...
> : ++$hits{$_};
--
Larry Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Sun, 21 Mar 1999 04:07:21 GMT
From: ramzes@my-dejanews.com
Subject: Re: Q: How do i?
Message-Id: <7d1r9j$iud$1@nnrp1.dejanews.com>
> I have a little problem. Now I'm trying to write search engine for my site
can you explain what does this mean, "my site"?
;)
ramzes lyrics collection = 2360 groups/artist
mailto:lyricshq@mail.ru
fidonet:2:5037/9.17
>
> PS/2: Sorry for my lame English :( I'm from Russia
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 19 Mar 1999 13:05:41 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Q: opening multiple filehandles concurrently?
Message-Id: <MPG.115c5bfcbe5805ae98978d@nntp.hpl.hp.com>
In article <comdog-ya02408000R1903991401210001@news.panix.com> on Fri,
19 Mar 1999 14:01:21 -0500, brian d foy <comdog@computerdog.com> says...
> In article <7cu42n$bvv$1@nnrp1.dejanews.com>, anna@water.ca.gov posted:
>
> > Is it possible to have more than one filehandle open concurrently?
>
> yes. you even start off with a couple open already :)
New definition of 'a couple' -- three? I thought that was a 'crowd'.
;-)
But only two are open for output.
--
Larry Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 21 Mar 1999 05:43:43 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Regex Question
Message-Id: <7d20uf$ftc$2@client2.news.psi.net>
Gene Wilburn (gwilburn@home.com) wrote on MMXXVIII September MCMXCIII in
<URL:news:36F45CB8.48D7A089@home.com>:
// I'm writing a Perl script to snork in the contents of Unix cal to create
// a calendar array in my program. I'm hitting a snag. My regular
// expression doesn't work if the line is less than seven days long. I.e.:
Just split on whitespace.
Abigail
--
perl -wle 'print "Prime" if ("m" x shift) !~ m m^\m?$|^(\m\m+?)\1+$mm'
------------------------------
Date: Sat, 20 Mar 1999 21:31:21 -0700
From: Martin Foster <mfoster@spots.ab.ca>
Subject: Sending Mail Though SMTP
Message-Id: <36F47619.6197A045@spots.ab.ca>
Though I have a copy of sendmail on my system, I would much rather
employ a SMTP connection to send out mail if needed. While this may
seem pointless to some, it is necessary for me, to have portable code,
and that means being able to local machines with Sendmail or systems
that have access to a SMTP server but no direct access to sendmail.
I have constructed a rather rudimentary script that works fairly well on
a Sendmail server. I have yet to try it on another MTA as yet, so I
cannot be sure that it will work at all times... But I will admit that
it will most probably fail. The problem, with the current script is
the error messages it produces while I am sending out a message.
Hopefully someone can help, though given time and another few books
(Code based off Learning Perl, Perl Cookbook did not help), I might be
able to pull it off.
The code is below my signature, as well as a sample system log.
Martin Foster
mfoster@spots.ab.ca
#!/usr/bin/perl -w
##########################################################
#
# Mailer Test
#
##########################################################
# Created : Martin Foster
# Modified : 03/20/98
##########################################################
####################
# Modules
#use strict;
use IO::Socket;
####################
# Global Variables
# Protocol Speciifc
$host="localhost";
# User Specific (Will be phased out eventually)
$From="mfoster\@spots.ab.ca"; # Sender
$To="mfoster\@spots.ab.ca"; # Target
####################
# Main Program
# Create Instance
$Mailer = IO::Socket::INET->new ( # Create and Object
Proto => "tcp", # Use TCP Protocol
PeerAddr => "$host", # Connect to Specified Host
PeerPort => "smtp(25)" ) # Connects to SMTP on Port 25
or die "Cannot open the SMTP Port at $host";
# Information to Output to SMTP
#$value = <$Mailer>; print $value;
print $Mailer "ehlo 1234\n"; # Primary Greeting
print $Mailer "mail from: $From\n"; # Specify Sender
do {
$line=<$Mailer>;
print $line;
} until ($line =~ /ok/i);
print $Mailer "rcpt to: $To\n"; # Target E-Mail (only 1 for now)
do {
$line=<$Mailer>;
print $line;
} until ($line =~ /ok/i);
print $Mailer "data\n"; # Opens prompt for data
print $Mailer "Date: `date`\n";
print $Mailer "Blah!\n"; # Really Small Message
print $Mailer ".\n"; # Sends Message
print $Mailer "quit\n"; # Closes the SMTP Connection
close $Mailer
###############
Mar 20 20:10:16 outreach sendmail[17305]: UAA17305:
from=mfoster@spots.ab.ca, size=6, class=0, pri=30006, nrcpts=1, msgi
d=<199903210310.UAA17305@outreach.dynip.com>, proto=ESMTP,
relay=IDENT:root@localhost [127.0.0.1]
Mar 20 20:10:16 outreach sendmail[17305]: NOQUEUE: SYSERR: putoutmsg
(localhost): error on output channel sending "250 UAA17305 Message
accepted for delivery": Broken pipe
Mar 20 20:10:17 outreach sendmail[17307]: UAA17305:
to=mfoster@spots.ab.ca, delay=00:00:01, xdelay=00:00:01, mailer=esmtp,
relay=cheetah.spots.ab.ca. [209.115.174.2], stat=Sent (UAA16241 Message
accepted for delivery)
Mar 20 20:12:18 outreach sendmail[17314]: UAA17314:
from=mfoster@spots.ab.ca, size=20, class=0, pri=30020, nrcpts=1, msg
id=<199903210312.UAA17314@outreach.dynip.com>, proto=ESMTP,
relay=IDENT:root@localhost [127.0.0.1]
Mar 20 20:12:18 outreach sendmail[17314]: NOQUEUE: SYSERR: putoutmsg
(localhost): error on output channel sending "250 UAA17314 Message
accepted for delivery": Broken pipe
Mar 20 20:12:20 outreach sendmail[17316]: UAA17314:
to=mfoster@spots.ab.ca, delay=00:00:02, xdelay=00:00:02, mailer=esmt p,
relay=cheetah.spots.ab.ca. [209.115.174.2], stat=Sent (UAA16678 Message
accepted for delivery)
Mar 20 20:14:47 outreach sendmail[17321]: UAA17321:
from=mfoster@spots.ab.ca, size=19, class=0, pri=30019, nrcpts=1, msg
id=<199903210314.UAA17321@outreach.dynip.com>, proto=ESMTP,
relay=IDENT:root@localhost [127.0.0.1]
Mar 20 20:14:47 outreach sendmail[17321]: NOQUEUE: SYSERR: putoutmsg
(localhost): error on output channel sending "250 UAA17321 Message
accepted for delivery": Broken pipe
Mar 20 20:14:48 outreach sendmail[17323]: UAA17321:
to=mfoster@spots.ab.ca, delay=00:00:01, xdelay=00:00:01, mailer=esmtp,
relay=cheetah.spots.ab.ca. [209.115.174.2], stat=Sent (UAA16759 Message
accepted for delivery)
------------------------------
Date: Fri, 19 Mar 1999 15:46:19 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Simple perl question
Message-Id: <MPG.115c81aae3264fbc989794@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <7culi5$hsj$1@news4.svr.pol.co.uk> on Fri, 19 Mar 1999
23:11:54 -0000, Kelsang Wangchuk <wangchuk@bodhisattva.freeserve.co.uk>
says...
> Dear Perl peeps,
Peep, peep. ???
> I started learning Perl about ten minutes ago using the Wall, Christiansen
> and Randal text,
Larry, Moe and Curly; or Wall, Christiansen and Schwartz...
> and already have a question.
And actually a reasonable one!
> I understand that the line...
>
> chop($number = <STDIN>);
>
> ...removes the carraige return from the input and places the number in
> $number.
Not the carriage return -- the last character, which is usually a
newline character "\n", as in C. 'chomp' is better.
> To me, however, this does not seem intuitive: if this were a C
> program, then the result of this line would certainly be CR-free, but since
> the chop surrounds the assignment, the $number itself would still have a CR
> attached to it. What's going on?
In C, arguments are passed to a subroutine by value, so the subroutine
cannot change their values. In Perl, arguments are passed to a
subroutine by reference (as in Fortran and other languages), so the
subroutine can change their values.
Get used to it!
[alt.perl removed]
--
Larry Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 18 Mar 1999 23:56:17 -0500
From: "Robert Gwynne" <gwynne@utkux.utk.edu>
Subject: Simple Subset Question
Message-Id: <7cslkg$kig$1@gaia.ns.utk.edu>
I'm trying to write an algorithm that gives me all combinations of an array
such that if @array = (a b c d), it produces:
ab ac ad bc bd cd
or
aa ab ac ad bb bc bd cc cd
I've tried variations on the example program below to no avail. It seems
that I should be able to delete the first item of the array each time
through the loop and end up with all the combinations. However, if I comment
out the penultimate line "shift(@array);", I get all of the combinations.
For example:
aa ab ac ad ba bb bc bd ca cb cc cd da db dc dd
They are there, but there's too much redundancy for what I want.
It looks like a problem for CS101, but I'm at a loss to figure out what the
problem is.
#!/usr/local/bin/perl -w
@array = qw(a b c d);
foreach $item(@array){
foreach $element(@array){
print "$item times $element\n";
}
shift(@array);
}
---------------------------
Bob Gwynne
gwynne@utkux.utk.edu
Speech Comm
University of Tennessee, Knoxville
JAPN (Just Another Perl Newbie)
------------------------------
Date: 20 Mar 1999 20:39:07 -0800
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Simple Subset Question
Message-Id: <yld8234ftg.fsf@windlord.stanford.edu>
Robert Gwynne <gwynne@utkux.utk.edu> writes:
> I've tried variations on the example program below to no avail. It seems
> that I should be able to delete the first item of the array each time
> through the loop and end up with all the combinations. However, if I
> comment out the penultimate line "shift(@array);", I get all of the
> combinations. For example: aa ab ac ad ba bb bc bd ca cb cc cd da db dc
> dd They are there, but there's too much redundancy for what I want.
> #!/usr/local/bin/perl -w
> @array = qw(a b c d);
> foreach $item(@array){
> foreach $element(@array){
> print "$item times $element\n";
> }
> shift(@array);
> }
In man perlsyn, it says:
If any part of LIST is an array, foreach will get very confused if you
add or remove elements within the loop body, for example with splice.
So don't do that.
which is probably part of the problem. I think this is one of the few
times that you want to use an iterator in Perl, or at least that's the
first solution that comes to mind:
windlord:~> perl -w
@array = qw(a b c d);
for (my $i = 0; $i < @array; $i++) {
for (my $j = $i; $j < @array; $j++) {
print "$array[$i]$array[$j] ";
}
}
print "\n";
aa ab ac ad bb bc bd cc cd dd
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: Fri, 19 Mar 1999 13:09:42 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Substitution question
Message-Id: <MPG.115c5cf1ec00d6c098978e@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <7cu6o6$f6r$1@nnrp1.dejanews.com> on Fri, 19 Mar 1999
18:58:26 GMT, zerokey@my-dejanews.com <zerokey@my-dejanews.com> says...
> I am trying to strip the domain name out of an email address..
>
> ex. change SOMEONE@SOMEPLACE.COM to just SOMEONE
>
> I thought a simple $name=s/\@SOMPLACE.COM// would do it, but alas, it does
> not.
>
> Any suggestions?
1. Use the 'bind' operator '=~' instead of the 'assign' operator '='.
2. Spell SOMEPLACE correctly in the regex.
3. Escape the '.' also (though that doesn't really matter here).
--
Larry Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 12 Dec 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 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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 5189
**************************************