[10890] in Perl-Users-Digest
Perl-Users Digest, Issue: 4491 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Dec 24 03:07:21 1998
Date: Thu, 24 Dec 98 00:00:51 -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 Thu, 24 Dec 1998 Volume: 8 Number: 4491
Today's topics:
Re: a nicer way? (Jason Costomiris)
Re: Cannot build: egcs _fails_ on 5.005_02 & NT4 <metcher@spider.herston.uq.edu.au>
Re: Cannot build: egcs _fails_ on 5.005_02 & NT4 <mds-resource@mediaone.net>
Re: Executing Program <aqumsieh@matrox.com>
Forcing To Lowercase - Another Way? (Ralph Freshour)
Re: help with indirect reference for pattern match (Steven Barbash)
Re: help with indirect reference for pattern match (Steven Barbash)
Re: help with indirect reference for pattern match (Tad McClellan)
Re: How can I get the Mime Content-type of a file <bill@fccj.org>
Re: How to duplicate a list of lists (corrected email a ptimmins@netserv.unmc.edu
Re: How to duplicate a list of lists (corrected email a (Larry Rosler)
Re: How to open a background process in Perl and CGI/Pe (Brian Lavender)
Is Perl as multifunctional as I've heard\read? <x@y.com>
Re: Is Perl as multifunctional as I've heard\read? (Tad McClellan)
Re: Is Perl as multifunctional as I've heard\read? <support@iscusa.com>
Re: link checker help <ebohlman@netcom.com>
Meta search engine <biela@netdienste.de>
Meta search engine <biela@netdienste.de>
Re: Meta search engine (Tad McClellan)
Re: need help speeding up program (Larry Rosler)
Re: please help with if statement syntax <aqumsieh@matrox.com>
Re: Real Newbie--please help <aqumsieh@matrox.com>
Re: Real Newbie--please help <bill@fccj.org>
Re: Regex question - removing HTML tags.... (GiLLY)
Re: regular expression alternation ptimmins@netserv.unmc.edu
Re: Retrospective on comp.lang.perl.moderated? <jwdavison@lucent.com>
searching for pattern in a file (BXTC)
Re: searching for pattern in a file (Tad McClellan)
string problem <mox@videotron.ca>
Re: string problem <ebohlman@netcom.com>
Re: string problem (Larry Rosler)
The quine page <gthompso@sun.iwu.edu>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 24 Dec 1998 05:49:37 GMT
From: jcostom@madcow.jasons.org (Jason Costomiris)
Subject: Re: a nicer way?
Message-Id: <slrn783lfh.59m.jcostom@madcow.jasons.org>
On 23 Dec 1998 17:07:34 GMT, Tom Christiansen <tchrist@mox.perl.com> wrote:
: use CGI qw(:standard);
: $id = param("id");
: $name = param("name");
: $info = param("info");
That works fine && dandy, but suppose you're an OOP kind of guy...
use CGI qw(:standard);
my $query = new CGI;
my $id = $query->param("id");
my $name = $query->param("name");
my $info = $query->param("info");
Is there any particular advantage (aside from fewer keystrokes) to
what you wrote, vs. what I have above?
I realize that it's not practical to read and parse the environment multiple
times, but I see the above as "good practice", in that you create an instance
of an object, then invoke methods, as you might do with other modules.
--
Jason Costomiris <>< | Linux...
jcostom@jasons.org | "Find out what you've been missing
http://www.jasons.org/~jcostom/ | while you've been rebooting Windows NT."
#include <disclaimer.h> | --Infoworld
------------------------------
Date: Thu, 24 Dec 1998 15:59:25 +1000
From: Jaime Metcher <metcher@spider.herston.uq.edu.au>
Subject: Re: Cannot build: egcs _fails_ on 5.005_02 & NT4
Message-Id: <3681D83D.E80CA9B2@spider.herston.uq.edu.au>
Michael D. Schleif wrote:
>
> Jaime, et al. ==>
>
> Sorry, this maybe too long -- I have tried to annotate as best I can
> *without* losing critical content }:-^
>
>
> ##########
>
> OK, what am I doing wrong?
>
> Following are _with_ the patch:
>
> ##########
>
> D:\p500502\win32>dmake
> del /f config.h
> Could Not Find D:\p500502\win32\config.h
> copy config_H.gc config.h
> 1 file(s) copied.
> gcc -c -I..\lib\CORE -I.\include -I. -I.. -DWIN32 -DPERLDLL
> -DPERL_CORE -g -O2 -operlglob.o perlglob.c
> gcc -Ld:\egcs-1.1\lib -o ..\perlglob.exe perlglob.o -ladvapi32
> -luser32 -lnetapi32 -lwsock32 -lmingw32 -lgcc -lmoldname -lcrtdll
> -lkernel32
> if not exist ".\mini" mkdir ".\mini"
> gcc -c -I..\lib\CORE -I.\include -I. -I.. -DWIN32 -DPERLDLL
> -DPERL_CORE -g -O2 -o.\mini\av.o ..\av.c
> In file included from ..\lib\CORE\config.h:2100,
> from ..\perl.h:137,
> from ..\av.c:16:
> ..\lib\CORE\win32.h:30: warning: `__declspec' redefined
> *Initialization*:1: warning: this is the location of the previous
> definition
> In file included from ..\lib\CORE\config.h:2100,
> from ..\perl.h:137,
> from ..\av.c:16:
> ..\lib\CORE\win32.h:216: warning: `_environ' redefined
Ummm...looks like still no patch. I suspect you are patching
d:\p500502\win32\win32.h, and config.h is including
d:\p500502\lib\core\win32.h. I suspect they both need to be patched -
on my system both are patched, and the build is fine.
I further suspect that the makefile isn't picking this up, but I thought
I'd post this while I'm testing that.
> d:\egcs-1.1\lib\gcc-lib\i386-mingw32\egcs-2.91.57\..\..\..\..\i386-mingw32\include\stdlib.h:87:
> warning: this is the location of the previous definition
<snip>
--
Jaime Metcher
------------------------------
Date: Thu, 24 Dec 1998 00:55:28 -0600
From: "Michael D. Schleif" <mds-resource@mediaone.net>
Subject: Re: Cannot build: egcs _fails_ on 5.005_02 & NT4
Message-Id: <3681E560.98736563@mediaone.net>
Jaime ==>
Good call!
That was exactly it }:-^
Sorry, that I am such a sorry C programmer; but, I've gotta start
somewhere . . .
Please, please, have fantastic holiday! I owe you one . . .
Jaime Metcher wrote:
>
> Ummm...looks like still no patch. I suspect you are patching
> d:\p500502\win32\win32.h, and config.h is including
> d:\p500502\lib\core\win32.h. I suspect they both need to be patched -
> on my system both are patched, and the build is fine.
--
Best Regards,
mds
mds resource
888.250.3987
"Dare to fix things before they break . . . "
"Our capacity for understanding is inversely proportional to how much we
think we know. The more I know, the more I know I don't know . . . "
------------------------------
Date: Wed, 23 Dec 1998 19:27:08 -0500
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Executing Program
Message-Id: <x3y67b2s7tv.fsf@tigre.matrox.com>
"Matty" <mattfreeman@mcmail.com> writes:
> How can I execute a program and get's it return
> value using perlscript?
There's More Than One Way To Do It (tm).
The easiest of which would be:
$return = qx/traceroute yahoo.com/;
Ala
------------------------------
Date: Thu, 24 Dec 1998 06:55:02 GMT
From: ralph@primemail.com (Ralph Freshour)
Subject: Forcing To Lowercase - Another Way?
Message-Id: <3681e400.7558880@news.mindspring.com>
I'm using tr/A-Z/a-z/ to force a string to all lowercase - however, I
noticed that this statement does not always show up when I am stepping
thru my code in the debugger. Is there another way I can force a
string to all lowercase, I'd like to try it out and see if it displays
in my debugger. I am using perl 5.
Also, sometimes some lines don't show in the debugger that are there
in the source code - what would cause this?
Thank you...
Ralph Freshour
------------------------------
Date: Wed, 23 Dec 1998 22:44:54 -0500
From: stevenba@ccpl.carr.org (Steven Barbash)
Subject: Re: help with indirect reference for pattern match
Message-Id: <MPG.10eb82bd989f5658989682@www.siast.sk.ca>
Matthew,
Thanks for your response.
But,
>What you want is qr//.
I can't find this.
What version of perl is it in?
(I believe I have pearl 5 or 5.04)
Have you a (url) reference to perlop that documents qr?
Thanks,
Steve
------------------------------
Date: Wed, 23 Dec 1998 23:17:09 -0500
From: stevenba@ccpl.carr.org (Steven Barbash)
Subject: Re: help with indirect reference for pattern match
Message-Id: <MPG.10eb8a52234348b0989683@www.siast.sk.ca>
Matthew,
After my last post, I checked further.
My perl is 5.00397.
I did find an online perlop. And found qr//
I'm back to my original question -- with the qualifier that I need to do
this in perl version 5.005
Steve
------------------------------
Date: Thu, 24 Dec 1998 00:19:36 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: help with indirect reference for pattern match
Message-Id: <odms57.9a1.ln@magna.metronet.com>
Steven Barbash (stevenba@ccpl.carr.org) wrote:
: I did find an online perlop. And found qr//
: I'm back to my original question -- with the qualifier that I need to do
: this in perl version 5.005
----------------------
#!/usr/bin/perl -w
$x = 'this has my pattern in it';
$re = qr/my pattern/;
if ( $x =~ $re )
{ print "matched my pattern\n" }
else
{ print "did NOT match my pattern\n" }
----------------------
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 23 Dec 1998 22:41:13 -0500
From: Bill Jones <bill@fccj.org>
Subject: Re: How can I get the Mime Content-type of a file
Message-Id: <3681B778.AC29F0F0@fccj.org>
Edouard Ouin wrote:
>
> Hi,
>
> Thank's for responding, but apple Macintosh file and sometimes Win95
> files doesn't have an extension....
> so have you got an other idea, please...I'll appreciate
>
> Thank's for your time
>
> Russ Allbery wrote:
>
> > Edouard Ouin <Edouard.Ouin@tinet.ie> writes:
> >
> > > How can I get the Mime Content-type of a file that is store on my
> > hard
> > > drive. I want to get a Mime content-type that is defined in the
> > > mime.type defined in Apache web server configuration.
> >
> > The way that the web server does this is that it looks at the file
> > extension and then looks it up in a database of mappings from file
> > extension to MIME type. If you want to get the same information,
> > you'll
> > probably have to do the same thing.
> >
Hmmm, didn't mention a platform the first time...
The proper extension is the way to go. However, in the Apache docs
which come with the apache server, you can force the issue on a per
file by file basis.
Look it up at http://www.apache.org/manual-index.cgi/docs?MIME
HTH,
-Sneex- :]
______________________________________________________________________
Bill Jones | FCCJ Webmaster | http://www.fccj.org/cgi/mail?webmaster
http://certserver.pgp.com:11371/pks/lookup?op=get&search=0x37E70D5E
------------------------------
Date: Thu, 24 Dec 1998 04:06:32 GMT
From: ptimmins@netserv.unmc.edu
Subject: Re: How to duplicate a list of lists (corrected email address)
Message-Id: <75sek7$p3l$1@nnrp1.dejanews.com>
In article <3681758B.F613F9C0@yahoo.com>,
LingMin Zhu <lingminz@yahoo.com> wrote:
> (The message I posted last time has the wrong return email address.)
>
> Hi,
>
> I have a question about how to duplicate a list of lists without
> traverse the entire lists myself.
>
> This an example:
>
> $a = [[1,[3,4],3],8];
> $b = $a;
>
> Now $b just simply point to $a. But what I want is a separate copy of
> list.
> Anyone know how to do this?
Well, instead of building up your $a in one fell swoop with anonymous arrays,
you could be more explicit, like this:
$c = [3,4];
$b = [1,@$c,3];
$a = [@$b,8];
Then a copy of $a is just:
@copy = @$a;
Patrick Timmins
$monger{Omaha}[0]
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Wed, 23 Dec 1998 23:31:34 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: How to duplicate a list of lists (corrected email address)
Message-Id: <MPG.10eb8dacf47b3758989974@nntp.hpl.hp.com>
[Posted to comp.lang.perl.misc and copy mailed.]
In article <75sek7$p3l$1@nnrp1.dejanews.com> on Thu, 24 Dec 1998
04:06:32 GMT, ptimmins@netserv.unmc.edu <ptimmins@netserv.unmc.edu>
says...
+ In article <3681758B.F613F9C0@yahoo.com>,
+ LingMin Zhu <lingminz@yahoo.com> wrote:
...
+ > I have a question about how to duplicate a list of lists without
+ > traverse the entire lists myself.
...
+ > $a = [[1,[3,4],3],8];
+ > $b = $a;
+ >
+ > Now $b just simply point to $a. But what I want is a separate copy
+ > of list.
+ > Anyone know how to do this?
+
+ Well, instead of building up your $a in one fell swoop with anonymous
+ arrays, you could be more explicit, like this:
+
+ $c = [3,4];
+ $b = [1,@$c,3];
+ $a = [@$b,8];
+
+ Then a copy of $a is just:
+
+ @copy = @$a;
But these are different structures. His array @$a is (a reference to an
array which is (1, a reference to an array which is (3, 4), 3) followed
by 8). Your array @$a is a one-dimensional list (1, 3, 4, 3, 8). His
is just an example, but he clearly wants to copy a nested list.
MJD showed how to do a 'deep copy' to preserve the structure.
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 24 Dec 1998 06:46:54 GMT
From: brian@brie.com (Brian Lavender)
Subject: Re: How to open a background process in Perl and CGI/Perl?
Message-Id: <3682e338.36064803@news.pacbell.net>
I have an example. See my web page.
http://www.brie.com/coinduperl/
brian
--------------------
Brian Lavender
Sacramento, CA
http://www.brie.com/brian/
"If a train station is where the train stops,
what is a workstation?" -- Phil Adamson
On 7 Dec 1998 15:52:06 GMT, "William Tang" <wtang@flash.net> wrote:
>Hello, I have trouble on opening a background process in my Perl CGI
>program.
>In UNIX C, I can do it like:
>if((childpid=fork())==0) {
> if( (setpgid(getpid(),getpid())== -1) exit(1);
> executethebackgroundcommandhere();
> exit(1);
>} else { parentprocesshere(); }
>exit(0);
>
>Can I find any similar method in Perl (or special module) to do the same
>job, or in Perl CGI application, there is no way to open a background
>process? I'm on Solaris2.5.1 with Perl5.004 and Apache1.3.3. Thanks
------------------------------
Date: 24 Dec 1998 05:31:10 GMT
From: "sp" <x@y.com>
Subject: Is Perl as multifunctional as I've heard\read?
Message-Id: <01be2eff$408a5ba0$606084a9@nec>
I have always had an interest in programming, but I am a tech support\net
admin person
primarily. I have been looking for a language that would span between
different computer
disciplines. It seems as though Perl more than any other language is able
to do this.
I've read that it could be used for network admin, web\internet
programming, Unix\mainframe,
graphics purposes, databases, etc.
Perl seems very related to C\C++, but my impression is that C\C++ is not as
versatile
and is more complex.
Could this be the best language to learn if you want to "do a little of
everything"?
How does it compare to C\C++, Visual Basic, or Java? Is this a very
useful language for
network administration purposes, especially in regards to NT?
I'm no programming expert, so I'm seeking the advice of those who are.
Thanks for any feedback.
I've bought the O'Reilly book "Learning Perl for Win32 Systems" and I think
it's great.
------------------------------
Date: Thu, 24 Dec 1998 00:35:26 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Is Perl as multifunctional as I've heard\read?
Message-Id: <ebns57.0h1.ln@magna.metronet.com>
sp (x@y.com) wrote:
: I have always had an interest in programming, but I am a tech support\net
: admin person
: primarily. I have been looking for a language that would span between
: different computer
: disciplines. It seems as though Perl more than any other language is able
: to do this.
You seem to have it right ;-)
: I've read that it could be used for network admin, web\internet
^
: programming, Unix\mainframe,
^
: graphics purposes, databases, etc.
How come all your slashes lean the wrong way?
: Perl seems very related to C\C++, but my impression is that C\C++ is not as
: versatile
: and is more complex.
Perl is related to C, sh, awk, sed, BASIC, FORTRAN, Lisp, and others.
: Could this be the best language to learn if you want to "do a little of
: everything"?
Yes. You expected a different answer in this newsgroup? ;-)
: How does it compare to C\C++, Visual Basic, or Java?
Some parts are similar.
Some parts are very different.
: Is this a very
: useful language for
: network administration purposes,
Yes.
: especially in regards to NT?
I don't know.
( Oh, now I see what happened to your slashes... ;-)
: I'm no programming expert, so I'm seeking the advice of those who are.
: Thanks for any feedback.
: I've bought the O'Reilly book "Learning Perl for Win32 Systems" and I think
: it's great.
Books are a good third line of enquiry when you are wondering how
to get something done in Perl.
First would be the several hundred "pages" of documentation that
are included with the perl distribution itself.
Second would be searching a Usenet archive such as www.dejanews.com.
After that, you might resort to books.
Good luck!
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 23 Dec 1998 23:57:50 -0800
From: Raphael <support@iscusa.com>
Subject: Re: Is Perl as multifunctional as I've heard\read?
Message-Id: <3681F3FE.E8542FA5@iscusa.com>
After learning C/C++/Fortran/Pascal/Lisp/Basic/Java, I can confirm
that Perl is by _far_ the best language to learn if you are only
going to learn one. Mind you, its also hairy, inconsistent and strange,
but so's life.
sp wrote:
> I have always had an interest in programming, but I am a tech support\net
> admin person
> primarily. I have been looking for a language that would span between
> different computer
> disciplines. It seems as though Perl more than any other language is able
> to do this.
> I've read that it could be used for network admin, web\internet
> programming, Unix\mainframe,
> graphics purposes, databases, etc.
>
> Perl seems very related to C\C++, but my impression is that C\C++ is not as
> versatile
> and is more complex.
>
> Could this be the best language to learn if you want to "do a little of
> everything"?
> How does it compare to C\C++, Visual Basic, or Java? Is this a very
> useful language for
> network administration purposes, especially in regards to NT?
>
> I'm no programming expert, so I'm seeking the advice of those who are.
> Thanks for any feedback.
> I've bought the O'Reilly book "Learning Perl for Win32 Systems" and I think
> it's great.
------------------------------
Date: Thu, 24 Dec 1998 07:08:35 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: link checker help
Message-Id: <ebohlmanF4GJuB.4qI@netcom.com>
Clay Irving <clay@panix.com> wrote:
: In <3681470F.C67BDFC0@melsud.res.ray.com> Mike Godfrey <mtg82814@melsud.res.ray.com> writes:
: > I would like to use perl to check if an internet site exists or not,
: >for a link checker. I really don't have any idea of how to do it.
: Perl Modules are your friend. It could be as simple as:
:
: #!/usr/local/bin/perl -w
:
: use LWP::Simple;
:
: $url = "http://www.perl.com";
:
: if(!head($url)) {
: print "Bad URL: $url\n";
: }
:
AFAIK some servers will refuse HEAD requests for certain documents, so if
a HEAD fails, it's a good idea to try a GET before giving up.
------------------------------
Date: Thu, 24 Dec 1998 04:23:25 +0100
From: "Simon Biela" <biela@netdienste.de>
Subject: Meta search engine
Message-Id: <75sc53$obj@news.netcologne.de>
Hi,
I'd like to program a meta search engine, which reads in the output of other
search engines.
I know how to read in a file, but how do I read in a html file on another
server?
Thanks for quick help.
Merry Chrismas everybody
Simon Biela
------------------------------
Date: Thu, 24 Dec 1998 04:23:25 +0100
From: "Simon Biela" <biela@netdienste.de>
Subject: Meta search engine
Message-Id: <75sbsk$o2n@news.netcologne.de>
Hi,
I'd like to program a meta search engine, which reads in the output of other
search engines.
I know how to read in a file, but how do I read in a html file on another
server?
Thanks for quick help.
Merry Chrismas everybody
Simon Biela
------------------------------
Date: Thu, 24 Dec 1998 00:23:32 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Meta search engine
Message-Id: <4lms57.9a1.ln@magna.metronet.com>
Simon Biela (biela@netdienste.de) wrote:
: I'd like to program a meta search engine, which reads in the output of other
: search engines.
You might want to look into the WWW::Search module:
"WWW::Search is a collection of Perl modules which provide an API to
WWW search engines. Currently WWW::Search includes back-ends for
variations of AltaVista, Dejanews, Excite, HotBot, Infoseek, Lycos,
Magellan, PLweb, SFgate, Verity, WebCrawler, and Yahoo."
"The latest version of WWW::Search should always be available from
<http://www.isi.edu/lsam/tools/WWW_SEARCH/>"
: I know how to read in a file, but how do I read in a html file on another
: server?
For that you might want to use one of the LWP family of modules.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 23 Dec 1998 23:14:40 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: need help speeding up program
Message-Id: <MPG.10eb89bc264d93cc989973@nntp.hpl.hp.com>
[Posted to comp.lang.perl.misc and copy mailed.]
In article <3681441D.5152@jlab.org> on Wed, 23 Dec 1998 14:27:25 -0500,
Shane Dewitt <dewitt@jlab.org> says...
...
> the program currently take 54 seconds to parse and and write its output
> to file. its seems to me that this is entirely to long.
There are many things that could be improved in your program, starting
with your failure to use the '-w' flag and 'use strict;', your use of
external commands when Perl has built-in capabilities, your failure to
check and diagnose failures to open files, etc., etc. But sticking
to those things that most affect performance, I found these statements
in inner loops:
...
> @suffix = (@suffix, $item);
...
> @values = (@values, $item);
...
> @sigNames = (@sigNames,"${sigName}.${item}");
[unnecessary and distracting braces] ^ ^ ^ ^
...
Each of these attempts to append an element to an array causes
inordinate recopying of the array elements. Use the 'push' function
(`perldoc -f push`) and performance should improve dramatically.
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 23 Dec 1998 18:31:39 -0500
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: please help with if statement syntax
Message-Id: <x3y90fysaec.fsf@tigre.matrox.com>
medi@cybershell.com writes:
>
> if ( $Sum <= 9 )
> {
> Statement_1;
> }
> elsif ( $Sum > 9 && $sum <= 20 )
^^^^^^^^
That is redundant! If the first if condition ($Sum <= 9) fails, then
$Sum has to be > 9 .. no?
Also, I hope you mean $Sum <= 20 not $sum <= 20.
Perl is case-sensitive you know.
> {
> Statement_2;
> }
------------------------------
Date: Wed, 23 Dec 1998 18:45:01 -0500
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Real Newbie--please help
Message-Id: <x3y7lvis9s2.fsf@tigre.matrox.com>
Marquis de Carvdawg <carvdawg@patriot.net> writes:
> I can easily see why no one won the "Perl as a first programming language"
> war...whatever that is...with responses like these...
I didn't participate in that thread, and I don't get your point!
> > This is the only thing that annoys you about Win95??
> > Seriously now, I can think of two remedies:
> >
> > 1) Use the shebanh line at the beginning of your source code. For unix
> > systems, that's usually:
> >
> > #!/usr/bin/perl -w
> >
> > or something like that. I'm not sure about Windows, but have a look at
> > 'perldoc perlrun'. It should contain the solution.
> >
>
> Interesting how the "experts" respond. Look, don't get me wrong...I do
I'm not an expert (yet)! I never claimed to be one! I am a mere mortal!
> greatlyappreciate the fact that ANYONE takes the time to respond at all, but
> this
> response is just so far off base it isn't even funny. What you'll end up
Does it look like it's supposed to be funny? Where's the humour in it?
I can't see it (and hell, I wrote it)!!!
I gave two solutions to the original poster:
1) Read the docs (perlrun) ... nothing funny so far about guiding a
person to the proper information source.
2) (you didn't quote this one, since you thought it was serious - I
think)
Run the scripts by "perl script.pl" .. which should work on *ANY*
platform. Again .. nothing funny there.
> doing is
> frustrating the poor girl into becoming a Perl-hater...
How did you get to that conclusion? What is so frustrating and
annoying about my reply?
Would you care to elaborate please?
> Windows DOES NOT parse the shebang...it treats it like just another comment
> line.
I clearly stated that I wasn't sure about the shebang in windows, and
that the poster should consult the proper documentation. I quote
myself:
"I'm not sure about Windows, but have a look at
'perldoc perlrun'. It should contain the solution."
I never claimed that the shebang *WILL* work under windows.
I will verify that one day though.
Now .. what was the aim of your post?
Ala
------------------------------
Date: Wed, 23 Dec 1998 22:43:49 -0500
From: Bill Jones <bill@fccj.org>
Subject: Re: Real Newbie--please help
Message-Id: <3681B814.B2BC47FB@fccj.org>
Larry Rosler wrote:
>
> In article <3680B327.53E88B9A@patriot.net> on Wed, 23 Dec 1998 09:08:55
> +0000, Marquis de Carvdawg <carvdawg@patriot.net> says...
> ...
> > Windows DOES NOT parse the shebang...it treats it like just another comment
> > line.
>
> WRONG! It ignores the path, but parses the flags (such as '-w'), if
> any.
>
AND it makes good coding practice to include it for portability.
2 Cents,
-Sneex- :]
______________________________________________________________________
Bill Jones | FCCJ Webmaster | http://www.fccj.org/cgi/mail?webmaster
http://certserver.pgp.com:11371/pks/lookup?op=get&search=0x37E70D5E
------------------------------
Date: Thu, 24 Dec 1998 06:37:05 GMT
From: hklife@soback.kornet21.net (GiLLY)
Subject: Re: Regex question - removing HTML tags....
Message-Id: <3681e0f3.25474765@news.snu.ac.kr>
:<!-- So, what about this? --
:>
s/<!\s*-\s*-.*?-\s*-\s*>//gs;
------------------------------
Date: Thu, 24 Dec 1998 04:39:16 GMT
From: ptimmins@netserv.unmc.edu
Subject: Re: regular expression alternation
Message-Id: <75sghk$qgb$1@nnrp1.dejanews.com>
In article <MPG.10eb1d00ce3f9ebe9898f2@nntp.hpl.hp.com>,
lr@hpl.hp.com (Larry Rosler) wrote:
> Yuk. Let's try to make it comprehensible:
>
> ($name, $ext) =
> /^( # start of $1 ($name)
> [^.]+ # first filename (no dots allowed)
> (?:\.[^.]+)*? # as few as possible .more's
> ) # end of $1 ($name)
> (?:\.? # eat up last dot, if any
> ([^.]*) # extension, if any, in $2 ($ext)
> )$/x; # phew! (I mean, foo!)
Good work Larry. I quit after a while on this one, cause I could only
get two out of three varieties of file names with anything I tried
(with the three varieties being of the form 'file', 'file.a', and 'file.a.b')
The following little adjustment to your regex will also allow for files
starting with a literal '.' like '.elmrc' :
($name, $ext) =
/^( # start of $1 ($name)
[^.]* # first filename (no dots allowed), pt:now optional
(?:\.[^.]+)*? # as few as possible .more's
) # end of $1 ($name)
(?:\.? # eat up last dot, if any
(\.?[^.]*) # pt:optional dot, extension, if any, in $2 ($ext)
)$/x; # phew! (I mean, foo!)
I threw some 'pt:comments' in with your comments to explain:
made 'first filename' optional
added an optional literal '.' to the $ext capture
Patrick Timmins
$monger{Omaha}[0]
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 23 Dec 1998 09:30:41 -0600
From: Joe Davison <jwdavison@lucent.com>
Subject: Re: Retrospective on comp.lang.perl.moderated?
Message-Id: <xgohfum510e.fsf@nwswd131.ih.lucent.com>
lr@hpl.hp.com (Larry Rosler) writes:
> With year-end-assessment time rapidly approaching, would anyone care to
> comment on how comp.lang.perl.moderated has performed over its life of
> six months or so, relative to the hopes and expectations of its
> proponents?
>
I'm happy with not having the "Stupid Jerk! You asked a FAQ!" threads to
wade through.
--
Joe Davison jwdavison@lucent.com
------------------------------
Date: Wed, 23 Dec 1998 18:14:51 -0500
From: "(BXTC)" <bxtc@forfree.at>
Subject: searching for pattern in a file
Message-Id: <3681796B.29E6C8BE@forfree.at>
Hi, I am very new to perl and am tring to learn by doing as well as
reading. I am writing a small program annd I need it to be able to get
an IP out of a file. example:
system "netstat -n >> .netstat";
so now I need to search for a string in the .netstat file. I know that
the IP will start with 209.195.11.***. so I was thinking somehow I'd
search like this:
open (NTST, ".netstat");
now how do I look inside the file now that it is open?
I need to search for something like /209\.195\.11\..../ but have it
fill in the last 3 ...'s with the real numbers and then save it to a
string.
I think this should be pretty easy, and standard, but tring to find it
in "Learning Perl" by o'riley & associates has gotten me this far but I
am missing the actual part that does something. Thanks for your help
and I appologize for posting this really basic problem. John
------------------------------
Date: Thu, 24 Dec 1998 00:11:47 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: searching for pattern in a file
Message-Id: <3vls57.9a1.ln@magna.metronet.com>
(BXTC) (bxtc@forfree.at) wrote:
: I am writing a small program annd I need it to be able to get
: an IP out of a file. example:
: system "netstat -n >> .netstat";
: so now I need to search for a string in the .netstat file. I know that
: the IP will start with 209.195.11.***. so I was thinking somehow I'd
: search like this:
: open (NTST, ".netstat");
: now how do I look inside the file now that it is open?
while (<NTST>) { # loop through each line in the file
$ip = $1 if /(209\.195\.11\.\d{1,3})/
print "matched '$ip'\n";
}
: I need to search for something like /209\.195\.11\..../ but have it
: fill in the last 3 ...'s with the real numbers and then save it to a
: string.
You can also use a "pipe open" and avoid the temp file:
open (NTST, "netstat -n |") || die "could not fork";
# same while() loop as above
close(NTST) || die "error running netstat $!";
Learn to use the docs that come with perl.
Perl's functions are described in the 'perlfunc.pod' man page.
The entry for open() gives examples for both methods above.
You could have gotten your answer much more quickly that way,
rather than posting and waiting hours or days...
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 24 Dec 1998 06:32:43 +0000
From: Benoit Lefebvre <mox@videotron.ca>
Subject: string problem
Message-Id: <3681E00B.B05FEA74@videotron.ca>
Anyone can tell me how to know if a char is in a string ?
eg: I want to know if the char "|" is in the string $mystring ?
it is possible to do something like: if ("|" isin($mystring) ...
------------------------------
Date: Thu, 24 Dec 1998 07:19:50 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: string problem
Message-Id: <ebohlmanF4GKD2.56q@netcom.com>
Benoit Lefebvre <mox@videotron.ca> wrote:
: Anyone can tell me how to know if a char is in a string ?
: eg: I want to know if the char "|" is in the string $mystring ?
: it is possible to do something like: if ("|" isin($mystring) ...
perldoc -f index
perldoc perlre
------------------------------
Date: Wed, 23 Dec 1998 23:39:38 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: string problem
Message-Id: <MPG.10eb8f90eef8d39c989975@nntp.hpl.hp.com>
[Posted to comp.lang.perl.misc and copy mailed.]
In article <3681E00B.B05FEA74@videotron.ca> on Thu, 24 Dec 1998 06:32:43
+0000, Benoit Lefebvre <mox@videotron.ca> says...
> Anyone can tell me how to know if a char is in a string ?
>
> eg: I want to know if the char "|" is in the string $mystring ?
>
> it is possible to do something like: if ("|" isin($mystring) ...
Yes, it is possible. With varying efficiencies, these are some of the
ways:
if (index($mystring, '|') >= 0) { it's there ... }
if ($mystring =~ tr/|//) { it's there ... }
if ($mystring =~ /\|/) { it's there ... }
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 24 Dec 1998 00:34:08 -0600
From: Gary Thompson II <gthompso@sun.iwu.edu>
Subject: The quine page
Message-Id: <3681E060.C4E2626E@sun.iwu.edu>
Hi there,
I thought this group might be interested in my new page, The Quine
Page. It's a collection of all the self-reproducing programs I've been
able to find. I have quite a few in Perl, but I don't know it very
well. I
would love some input on which are 'cheats'. Come and see, though, as
it's
a pretty neat concept. Just drop on by at
http://www.nyx.net/~gthompso/quine.htm
--
__________________________________________________________________________
Tablua Materna combusta est! Sum in modo pessimo!
My motherboard fried! I'm in a pessimal
mode!
Gary P. Thompson II--gthompso@nyx.net
------------------------------
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 4491
**************************************