[9358] in Perl-Users-Digest
Perl-Users Digest, Issue: 2953 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jun 23 18:08:40 1998
Date: Tue, 23 Jun 98 15:00:32 -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 Tue, 23 Jun 1998 Volume: 8 Number: 2953
Today's topics:
Re: $^T <rootbeer@teleport.com>
Re: a bit confused about seek (M.J.T. Guy)
Re: A funny problem with "use integer" <merlyn@stonehenge.com>
ANNOUNCE: txt2pdf v. 1.0 anface@geocities.com
Calling C++ from Perl with c_plus_plus <sasha.romanosky@telus.com>
Chicago/Unix/Perl/Randal/TV show! (Bill Huston )
Re: Comparing conditional ? with if..else construct dgris@rand.dimensional.com
Re: Comparing the contents of an array? <psdspss@execpc.com>
Re: Comparing the contents of an array? <ajohnson@gpu.srv.ualberta.ca>
Re: Comparing the contents of an array? <rootbeer@teleport.com>
Re: Date Calculation Problems. <rootbeer@teleport.com>
EvoScript 4.00 - free web application framework - beta (Jeremy Bishop)
Re: Flames.... birgitt@my-dejanews.com
Re: How can I get the IP-Number & the Remote_Host Name <jdporter@min.net>
Re: MD5 and Perl4 (Pel Lxberg)
Re: moving perl -ne into a file? <rootbeer@teleport.com>
Re: Perl Job Posting <rootbeer@teleport.com>
Re: Placeholder item in qw// <danboo@negia.net>
Re: Placeholder item in qw// (Larry Rosler)
Re: Q: Can I run Perl program regularly? (Abigail)
Re: readling a file (M.J.T. Guy)
Re: Remove blank too much lines from a text file (Abigail)
Re: script to fill a form <rootbeer@teleport.com>
Re: Sending files via mail in perl (Abigail)
Would someone tell me what this means? <chiefs@fulton-net.com>
Re: Would someone tell me what this means? <altenbur@ncsa.uiuc.edu>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 23 Jun 1998 21:20:52 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: $^T
Message-Id: <Pine.GSO.3.96.980623142012.3227K-100000@user2.teleport.com>
On Tue, 23 Jun 1998, Wynn Fenwick wrote:
> What is the special variable $^T?
The perlvar manpage tells about all of Perl's special variables. Hope this
helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 23 Jun 1998 21:30:31 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: a bit confused about seek
Message-Id: <6mp6pn$3im$1@pegasus.csx.cam.ac.uk>
In article <358FD608.2270@min.net>, John Porter <jdporter@min.net> wrote:
>F.Quednau wrote:
>>
>> I did a little experiment on seek (I can't decide if I should jump around in the
>> file or slurp in completely into memory) - anyways, that's the program:
>>
>> open FILE, "< /u/quednauf/temp/testfile.txt" or die "didn't happen: $!";
>> for ($i =0; $i <=8; $i++) {
>> seek FILE, $i, 0 or die "Jumped off the cliff: $!";
>> print <FILE>;
>> }
>
>Dude, print takes a list of arguments, so <FILE> is in a list
>context: it returns every (remaining) line in the file!
Or, to be slightly pedantic, every remaining line or part line.
Which explains the blank lines in the output.
Mike Guy
------------------------------
Date: Tue, 23 Jun 1998 21:29:54 GMT
From: Randal Schwartz <merlyn@stonehenge.com>
Subject: Re: A funny problem with "use integer"
Message-Id: <8ciulr24e1.fsf@gadget.cscaper.com>
>>>>> "Vivek" == Vivek Khera <khera@kciLink.com> writes:
Vivek> [kci]% cat |perl
As I've said before, it's a good thing I don't give out Useless Use
of Cat Awards anywhere other than comp.unix.{shell,questions}.
<sigh>
print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 69 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: 23 Jun 1998 20:50:17 GMT
From: anface@geocities.com
Subject: ANNOUNCE: txt2pdf v. 1.0
Message-Id: <6mp4e9$cpv$1@news.neta.com>
txt2pdf is a very flexible PERL5 program.
It's a converter from text files to PDF format files.
Why do you need txt2pdf?
Most of your documents are text files (eg HTML, C source, C++ source,
PERL source, ...)
txt2pdf is a PERL5 script, so you can use it in every operating
systems supported by PERL5 (ANFACE tested it on many Unix boxes and on
'95 box with ActiveState's build of Perl for Win32)
txt2pdf is a native converter, you don't need to pass through
PostScript format
the fee for every license is only $10
ANFACE Software is going to give you a free license for every good
idea or for every good modify
Try it! http://www.geocities.com/CapeCanaveral/Hangar/4794/txt2pdf.html
Register it!
https://commerce.mindspring.com/cgi-bin/cgiwrap/www09282/reg_it_offsite.pl?50
66
ANFACE Software
mailto:anface@geocities.com
http://www.geocities.com/CapeCanaveral/Hangar/4794/
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Tue, 23 Jun 1998 15:44:11 -0600
From: Sasha Romanosky <sasha.romanosky@telus.com>
Subject: Calling C++ from Perl with c_plus_plus
Message-Id: <359021AA.7BB7F43D@telus.com>
I've taken a look at the c_plus_plus package at
http://www.gmd.de/CPAN/modules/by-module/c_plus_plus/ILYAZ/modules
and while this is very useful, I have questions.
In the test c++ code; c_plus_plus.xs:
"#ifdef __cplusplus
extern "C" {
#endif
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#ifdef __cplusplus
}
#endif
class aaa {
public:
char name[100];
aaa(char *s) {strcpy(name,s); printf("Initializing `%s'...\n",
name);}
~aaa() {printf("Destroying `%s'...\n", name);}
message() {printf("`%s' got message...\n", name);}
};
MODULE = c_plus_plus PACKAGE = c_plus_plus
BOOT:
aaa a("hello world");
a.message();
"
As well, there is the perl test code, test.pl:
"BEGIN {warn "In preinit!\n";} # Of course, the order is different in
static and dynamic version
use c_plus_plus;
warn "After initialization.\n";
"
Essentially all this perl code does is invoke the package c_plus_plus
which runs the
code under BOOT. This is great, however, I would like to be able to
instantiate an
aaa object and run the message method from perl.
And so the .xs file would look as it does but without code beneath BOOT,
and
the perl code would look something like this;
"#!/usr/local/bin/perl
use c_plus_plus;
c_plus_plus::aaa->("hello world");
c_plus_plus::aaa->message();
"
While a compilation succeeds, execution fails with the error that it
cannot
find auto/c_plus_plus/aaa.al in @INC..., which, I suppose, makes sense.
However, I'm not sure where to go from here.
Is there a better way (that I'm missing) to be able to run c++ code from
perl (in addition to using a system() command)??
Any advice or snipets of sample code would be greatly appreciated.
cheers,
Sasha Romanosky
sasha.romanosky@telus.com
------------------------------
Date: 23 Jun 1998 21:11:40 GMT
From: bhuston@zeus.anet-chi.com (Bill Huston )
Subject: Chicago/Unix/Perl/Randal/TV show!
Message-Id: <6mp5mc$2or$1@news1.anet.com>
As you might have heard, Randal Schwartz is coming to the Windy City,
as a guest of the Chicago Perl Mongers. We are frantically trying to
coordinate a TV interview, for an upcoming cablecast on surbarban
TCI ch 35.
WE NEED A STUDIO AUDIENCE! It will be shot either Friday night (June 26),
or Saturday morning (27th), and either at the TCI Skokie or Mt. Prospect
studio. Details are still being worked out...
If you would like to attend the taping, send me an email at
bhuston@eden.com w/subject something like "perl tv". Also, you
may want to check the 'Monger's page: http://chicago.pm.org
Bill Huston
thus spake jima@MCS.COM (Jim Allenspach):
:
: Perl hacker and karaoke enthusiast Randal Schwartz will be giving
:his JACPH (Just Another Convicted Perl Hacker) talk on Saturday, June 27th,
:1998 at the Harold Washington Library at noon.
:
: Mr. Schwartz will speak on computer security and public policy,
:issues of pressing importance to computer professionals. All interested
:professionals, students, and members of the public are encouraged to attend.
:This event is sponsored by Chicago Perl Mongers, and is open to the public.
:Donations to Mr. Schwartz's legal and travelling expenses will be
:appreciated.
:
: For more information, contact James Allenspach at jima@mcs.net, or
:check out the Chicago Perl Mongers homepage at http://chipm.i-2.com/.
:
:jma
------------------------------
Date: Tue, 23 Jun 1998 21:06:32 GMT
From: dgris@rand.dimensional.com
Subject: Re: Comparing conditional ? with if..else construct
Message-Id: <6mp4qo$bs$1@rand.dimensional.com>
[posted and mailed to the cited author]
In article <MPG.ff9af273b900cab9896b9@nntp.hpl.hp.com>,
Larry Rosler <lr@hpl.hp.com> wrote:
>But this is not the case under discussion. The code in question has an
>assignment between the ? and the : like so:
>
>$b % 5 ? $a += 2 : $b += 5;
>
>How does *that* get parsed? The result is
($b % 5 ? $a += 2 : $b) += 5;
which gives-
(($b % 5) ? ($a += 2) : ($b)) += 5;
which (with $a == 5 and $b == 6) gives-
$a += 2 += 5;
>a: 12
>b: 6
>
>To me, this is sort of loony!
>
It only looks loony because of the assignment in
the conditional. Here's another example that might
make more sense-
status() ? $success : $fail += 1; #increment either success count
#or fail count depending on status()
This is not necessarily the easiest to read code, but it does
have uses.
>--
>Larry Rosler
Regards,
Daniel
--
Daniel Grisinger dgris@perrin.dimensional.com
"No kings, no presidents, just a rough consensus and
running code."
Dave Clark
------------------------------
Date: Tue, 23 Jun 1998 15:51:32 -0500
From: Deva Seetharam <psdspss@execpc.com>
Subject: Re: Comparing the contents of an array?
Message-Id: <35901553.80ECD53@execpc.com>
Bryan T Hoch wrote:
> Hi,
> I think this should be a simple question to answer, but I'm still not sure
> of a good way to do it.
> I want to compare the contents of two arrays. For example, if I have array
> A and array B, I want to be able to go through and see which elements
> array A has that array B doesn't have, and also which elements array B has
> that array A doesn't have.
> Is there a simple way of doing this?
> Thanks in advance for your help.
> Bryan H
Please look at perl faq at
http://www.perl.com/CPAN-local/doc/FAQs/FAQ/PerlFAQ.html#How_do_I_compute_the_diference_
hope that helps.
Deva
------------------------------
Date: Tue, 23 Jun 1998 16:16:31 -0500
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: Comparing the contents of an array?
Message-Id: <35901B2F.1C228698@gpu.srv.ualberta.ca>
Bryan T Hoch wrote:
>
> Hi,
> I think this should be a simple question to answer, but I'm still not sure
> of a good way to do it.
> I want to compare the contents of two arrays. For example, if I have array
> A and array B, I want to be able to go through and see which elements
> array A has that array B doesn't have, and also which elements array B has
> that array A doesn't have.
> Is there a simple way of doing this?
> Thanks in advance for your help.
The faqs have an entry dealing with this kind of thing if you know
what to search for (although searching for "arrays" would have worked :-):
perlfaq4.pod:=head2 How do I compute the difference of two
arrays? How do I compute the intersection of two arrays?
hope it helps
regards
andrew
------------------------------
Date: Tue, 23 Jun 1998 21:34:01 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Comparing the contents of an array?
Message-Id: <Pine.GSO.3.96.980623143257.3227M-100000@user2.teleport.com>
On Tue, 23 Jun 1998, Bryan T Hoch wrote:
> I want to compare the contents of two arrays. For example, if I have
> array A and array B, I want to be able to go through and see which
> elements array A has that array B doesn't have, and also which elements
> array B has that array A doesn't have.
Section four of the FAQ asks and answers, "How do I compute the difference
of two arrays?" Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 23 Jun 1998 21:12:34 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Date Calculation Problems.
Message-Id: <Pine.GSO.3.96.980623140835.3227G-100000@user2.teleport.com>
On Tue, 23 Jun 1998, Col wrote:
> I've looked through the faq's, used dejanews and searched on lots of
> perl pages the answer seems to be to use date::Manip.
> The problem is that my host can't (they are in some partnership thing
> with 7thgate???) install the mod, I tried and obviously I don't have the
> correct permissions setup to install it.
If your sysadmin can't install software, get a new one. But section eight
of the FAQ has information on keeping your own directory for modules. Good
luck!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 23 Jun 1998 21:05:00 GMT
From: jeremy@panix.com (Jeremy Bishop)
Subject: EvoScript 4.00 - free web application framework - beta release
Message-Id: <6mp59s$d27$1@news.neta.com>
WHAT IS EvoScript?
-------------------
EvoScript is a free, database-enabled web application framework written in
Perl. The framework facilitates development by providing an extensible
class framework and an easy-to-use embedded scripting syntax. It has grown
out of three years of programming effort at Evolution Online Systems. For
more information, investigate:
http://www.evoscript.org/about/
REQUIREMENTS
------------
Perl 5.003 (or higher)
Available at http://www.perl.com/CPAN/src/latest.tar.gz
CGI compliant web server
If you don't already have one installed, we recommend
Apache, available at http://www.apache.org
Unix or Windows NT Server
EvoScript has been used sucessfully with WinNT with minor
configuration changes, but is not fully supported in this release
(it'll work though).
AVAILABILITY
------------
The latest version of EvoScript is available at http://www.evoscript.org/
A CPAN release of EvoScript is approaching, but not here quite yet.
--
die( "why go on?\n" ) unless( $INC{'Evo::Script'} );
# Jeremy Bishop <jeremy@evolution.com>
# http://www.evoscript.org/
--
----------------
jeremy@panix.com
------------------------------
Date: Tue, 23 Jun 1998 20:45:39 GMT
From: birgitt@my-dejanews.com
Subject: Re: Flames....
Message-Id: <6mp45k$mi1$1@nnrp1.dejanews.com>
In article <8c67hs6ot4.fsf@gadget.cscaper.com>,
Randal Schwartz <merlyn@stonehenge.com> wrote:
>
> >>>>> "birgitt" == birgitt <birgitt@my-dejanews.com> writes:
>
> birgitt> Abigail said once here a couple of weeks ago, that the downfall
> birgitt> of usenet started with the invention of the "post" button on your
> birgitt> news reader (round about).
>
> I think that's a misquote *and* a misattribution. It was me who has
> said repeatedly:
>
> One of the most significant events in the "dumbing down" of Usenet
> was the day that Netscape added a "POST" button to their *web browser*
> making it pretend to be a newsreader (which it STILL isn't).
>
> And that's why people still routinely killfile any postings from web
> browsers. Ugh. (I don't, but I think about it very often.)
Yes, your are right on both accounts and I apologize.
The message which was vaguely in my mind to which I was referring
to was actually written a year ago on 1997/07/31 by mheins@prairie.net
message ID 5rov6$18e$1Avixen.cso.uiuc.edu as a response to a post
by Randal Schwartz which again was a response to Abigail.
Quote:
Subject line: Too many people in this group are arrogant...
Randal Schwartz wrote:
:Abigail>++ Providers don't teach people to go to news.answers
:Abigail>++ before starting to use USENET
:
:Abigail> Because that isn't a provider's task
:
: [snip]
:
: The start of the most recent downfall was the day Netscape
: put a "Post" button on their web browser. Ugh.
I would call it the POST-POST-POST button 8-).
Mike Heins
End of quote
This was way before I ever read c.l.p.m, I just happen to read
mheins posts regularly. That's why I hadn't in my mind who said
what. I am sorry.
Funny how things which stick to your mind always seem to have
happened just a couple of weeks ago, when it actually is already
a year.
Thanks, you made me sweat and search and I learned something 8-).
I will be more carefully next time and check the 'real' quote.
Birgitt Funk
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Tue, 23 Jun 1998 21:44:52 GMT
From: John Porter <jdporter@min.net>
Subject: Re: How can I get the IP-Number & the Remote_Host Name
Message-Id: <35902375.7862@min.net>
O.k., I know I'm just gettin silly here, but...
local $" = "=";
print map { s/=*([^=]+)=([^=]+)/$1=$2\n/g; $_ } "@{[%ENV]}";
--
John Porter
------------------------------
Date: 23 Jun 1998 23:47:43 +0200
From: pallo-njus@orakel.ntnu.no (Pel Lxberg)
Subject: Re: MD5 and Perl4
Message-Id: <dt4af73lri8.fsf@verden.pvv.ntnu.no>
Tom Phoenix <rootbeer@teleport.com> writes:
> On 23 Jun 1998, P=E5l L=F8berg wrote:
>
> > So what I'm really looking for is MD5 implemented in pure Perl code.
>
> This could be done. I doubt that it has, though, because that would be on
> the order of 100,000% slower than the implementation in the module. That's
> just a rough estimate; you're welcome to try to prove me wrong. But if you
> can calculate the MD5 checksum of your MD5 code with ordinary Perl4 in
> less than, oh, about a second, I'll have to ask how you can justify using
> a Cray when you've obviously got way too much spare time. :-)=20
That is a good reason not to do it this way. I've been looking at the
reference implementation and it shouldn't be too har to implement it
in Perl, but it would prboably be too slow.
Still, if anyone has done this it would at least be interesting to
compare the speed of the Perl version with a implementation in C.
--
*********************** Pel Brovold Lxberg *********************
E-mail: pallo @ pvv.org WWW: http://www.pvv.org/~pallo/
****************************************************************
------------------------------
Date: Tue, 23 Jun 1998 21:14:12 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: moving perl -ne into a file?
Message-Id: <Pine.GSO.3.96.980623141300.3227H-100000@user2.teleport.com>
On Tue, 23 Jun 1998 markf@acuityinc.com wrote:
> perl -ne 'print if (/LIB PART/ ? ($c = 18) : (--$c > 0))' proj.dat
>
> This command line works fine, but I would like to put it into a file and
> have the output put into an array, split if possible.
See the entry for -n in the perlrun manpage and you'll be more than
halfway there. Good luck!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 23 Jun 1998 20:28:40 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Perl Job Posting
Message-Id: <Pine.GSO.3.96.980623132726.3227C-100000@user2.teleport.com>
On Tue, 23 Jun 1998 pnassiff@my-dejanews.com wrote:
> What website do you recommend to place a job posting for a Perl
> Programmer position in Orlando, FL?
The Perl Institute's website says:
If you have job postings to submit, please send them to jobs@perl.org
I'm not sure what they do with them, though... :-)
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 23 Jun 1998 17:22:14 -0400
From: Dan Boorstein <danboo@negia.net>
Subject: Re: Placeholder item in qw//
Message-Id: <35901C86.CB3A7668@negia.net>
Allen Choy wrote:
>
> Hi,
>
> I was wondering if there was a way of putting a null item with qw//, as
> you can with @z = ( undef )?
>
based on how qw// is implemented internally, my translation of your
question is that your asking if you can get an undefined value out
of '@z = split;' where $_ is defined.
to my knowledge, this cannot be done.
cheers,
--
Dan Boorstein home: danboo@negia.net work: danboo@y-dna.com
"THERE IS AS YET INSUFFICIENT DATA FOR A MEANINGFUL ANSWER."
- Cosmic AC
------------------------------
Date: Tue, 23 Jun 1998 14:02:54 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Placeholder item in qw//
Message-Id: <MPG.ff9b7dd38eb58e99896bc@nntp.hpl.hp.com>
In article <35900701.DE68D6EF@us.oracle.com>, Allen Choy
<achoy@us.oracle.com> says...
> Hi,
>
> I was wondering if there was a way of putting a null item with qw//, as
> you can with @z = ( undef )?
Not that I know of.
@a = (qw( a b c ), '', qw( x, y, z ));
--
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 23 Jun 1998 21:12:49 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Q: Can I run Perl program regularly?
Message-Id: <6mp5oh$5uq$1@client3.news.psi.net>
D (dmgl@dmgl.kirov.ru) wrote on MDCCLVI September MCMXCIII in
<URL: news:358ecba4.0@rapeme.kirov.ru>:
++
++ How can I make a program that can run my Perl program regularly (daily)?
The same way as you run your Prolog program daily.
Abigail
--
perl -e '$_ = q *4a75737420616e6f74686572205065726c204861636b65720a*;
for ($*=******;$**=******;$**=******) {$**=*******s*..*qq}
print chr 0x$& and q
qq}*excess********}'
------------------------------
Date: 23 Jun 1998 21:11:52 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: readling a file
Message-Id: <6mp5mo$2p8$1@pegasus.csx.cam.ac.uk>
In article <358F70C6.513F3B5E@emw.ericsson.se>,
Robert Rehammar <Robert.Rehammar@emw.ericsson.se> wrote:
>I was readling a file with the following:
>
>open (fil,"file");
>@FILE=<fil>;
>close fil;
>print "@FILE";
>
>The contens of the file loks like:
>
>line one
>line two
>...
>
>
>The problem is that when I print it the output loks like:
>line one
> line two
> ...
>
>How do I remove this first blank ??
Change the print statement to
print @FILE;
For explanation, see the $" variable in perldoc perlvar.
Mike Guy
------------------------------
Date: 23 Jun 1998 21:23:06 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Remove blank too much lines from a text file
Message-Id: <6mp6bq$5uq$2@client3.news.psi.net>
Michael Zehrer (zehrer@dialup.nacamar.de) wrote on MDCCLVII September
MCMXCIII in <URL: news:358F8993.6B1782ED@dialup.nacamar.de>:
++ Hi out there,
++
++ Beeing not a Perl- Pro I need some advice how I can remove blank lines
++ from a text file or even reduce a number of blank lines too one. Like in
++ this example:
++ ------
++ line1
++
++
++ line2
++ line3
++
++ line4
++
++ ------
++ Thanks in advance, Michael
perl -i -pwe '$_ = "" unless /\S/' file1 file2 file3 ...
Abigail
--
perl -wle '$, = " "; sub AUTOLOAD {($AUTOLOAD =~ /::(.*)/) [0];}
print+Just (), another (), Perl (), Hacker ();'
------------------------------
Date: Tue, 23 Jun 1998 21:20:00 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: script to fill a form
Message-Id: <Pine.GSO.3.96.980623141823.3227J-100000@user2.teleport.com>
On Mon, 22 Jun 1998 natoofi@alborz.dac.neu.edu wrote:
> Is there a way that I can connect to some httpd server ( e.g.
> www.blah.blah ) and fill up a form, press send buttom and then quit.
You want the LWP module. Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 23 Jun 1998 21:30:54 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Sending files via mail in perl
Message-Id: <6mp6qe$5uq$3@client3.news.psi.net>
Jaime Metcher (metcher@spider.herston.uq.edu.au) wrote on MDCCLVII
September MCMXCIII in <URL: news:358F4456.4DA53D57@spider.herston.uq.edu.au>:
++ Zenin wrote:
++ >
++ <snip>
++ >
++ > Yes, there are ways to work around systems lacking an MTA. If you
++ > must work in suck conditions and want to stay at all portable at
++ > least use a best method test:
++ <snip>
++
++ My system *does* have an MTA, but you don't get to it by calling
++ sendmail. You get to it using SMTP. And it *is* local, but it's on the
++ *Local* Area Network, not on this machine. Doesn't everyone on a LAN do
++ it this way? The Unix philosophy of a complete toolbox on every machine
++ is great for flexibility, but unless you like applying security patches
++ I can't see any earthly reason for having 500 copies of *any* demon
++ running on a LAN (actually, I can, but in general most of these things
++ are a waste of space).
There are just too many programs sending mail automatically not to have
a mail deamon on every machine. cron, vi, rcs, etc, they all send mail.
Abigail
--
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'
------------------------------
Date: 23 Jun 1998 21:36:40 GMT
From: "Chris Edwards" <chiefs@fulton-net.com>
Subject: Would someone tell me what this means?
Message-Id: <01bd9eef$d228bf20$1cb0c9d0@chiefs>
I would like to know what these few short lines mean.
if ($FORM{'name'}) {
$name = "$FORM{'name'}";
$name =~ s/"//g;
$name =~ s/<//g;
$name =~ s/>//g;
$name =~ s/\&//g;
}
else {
&error(no_name);
Thanks for your time.
------------------------------
Date: Tue, 23 Jun 1998 16:53:22 -0500
From: david lee altenburg <altenbur@ncsa.uiuc.edu>
Subject: Re: Would someone tell me what this means?
Message-Id: <359023D1.57F8A033@ncsa.uiuc.edu>
--------------C0E395EC203141E0872F1F0E
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Chris Edwards wrote:
> I would like to know what these few short lines mean.
ok...i'll go through it, line by line
> if ($FORM{'name'}) {
this line is checking to see if the "name" entry in the %FORM hash
exists.I'm assuming you're new to perl, so you may not know what a hash,
or
associative array is....it's like an array that, instead of being
accessed by
integers, is accessed by other values, usually a string. In this case,
'name'
is called the key, and you use it to access another value. If a value
for the
key 'name' in the %FORM array exists, it returns true, and the lines
inside
the braces are exectuted. Otherwise, the lines inside the braces
following
the else are executed instead.
> $name = "$FORM{'name'}";
This line assigns the value for the key 'name' in %FORM
> $name =~ s/"//g;
s/regex1/regex2/g replaces all instances of regex1 (which is a regular
expresion) with regex2.Therefore, this line replaces all double
quotation marks with NULL, or, in other words, removes
all double quotation marks.This takes out all double quotation marks.
> $name =~ s/<//g;
> $name =~ s/>//g;
> $name =~ s/\&//g;
The above 3 lines are very similar...they just act on different
characters.
>
> }
> else {
> &error(no_name);
This calles the error subroutine, with no_name as the arguement.
> Thanks for your time.
No problem. I didn't give a real complete explanation, because that
would prolly require
an overview of the basics of the language. You may want to check out
"Learning Perl"
(the llama book). It would give you a good intro to the language, and
thouroughly (sp?)
answer you above question.
HTH,
David Altenburg
altenbur@ncsa.uiuc.edu
--------------C0E395EC203141E0872F1F0E
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<HTML>
Chris Edwards wrote:
<BLOCKQUOTE TYPE=CITE>I would like to know what these few short lines mean.</BLOCKQUOTE>
ok...i'll go through it, line by line
<BLOCKQUOTE TYPE=CITE>
<P>if ($FORM{'name'}) {</BLOCKQUOTE>
this line is checking to see if the "name" entry in the %FORM hash
exists.I'm assuming you're new to perl, so you may not know what a hash,
or
<BR>associative array is....it's like an array that, instead of being accessed
by
<BR>integers, is accessed by other values, usually a string. In this case,
'name'
<BR>is called the key, and you use it to access another value. If
a value for the
<BR>key 'name' in the %FORM array exists, it returns true, and the
lines inside
<BR>the braces are exectuted. Otherwise, the lines inside the braces
following
<BR>the else are executed instead.
<BLOCKQUOTE TYPE=CITE>
<P> $name = "$FORM{'name'}";</BLOCKQUOTE>
This line assigns the value for the key 'name' in %FORM
<BLOCKQUOTE TYPE=CITE> $name =~ s/"//g;</BLOCKQUOTE>
s/regex1/regex2/g replaces all instances of regex1 (which is a regular
expresion) with regex2.Therefore, this line replaces all double quotation
marks with NULL, or, in other words, removes
<BR>all double quotation marks.This takes out all double quotation marks.
<BLOCKQUOTE TYPE=CITE> $name =~ s/<//g;
<BR> $name =~ s/>//g;</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE> $name =~ s/\&//g;</BLOCKQUOTE>
The above 3 lines are very similar...they just act on different characters.
<BLOCKQUOTE TYPE=CITE> </BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE> }
<BR> else {
<BR> &error(no_name);</BLOCKQUOTE>
This calles the error subroutine, with no_name as the arguement.
<BLOCKQUOTE TYPE=CITE>
<P>Thanks for your time.</BLOCKQUOTE>
No problem. I didn't give a real complete explanation, because that would
prolly require
<BR>an overview of the basics of the language. You may want to check
out "Learning Perl"
<BR>(the llama book). It would give you a good intro to the language, and
thouroughly (sp?)
<BR>answer you above question.
<P>HTH,
<P>David Altenburg
<BR>altenbur@ncsa.uiuc.edu
<BR>
<PRE></PRE>
</HTML>
--------------C0E395EC203141E0872F1F0E--
------------------------------
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 2953
**************************************