[13690] in Perl-Users-Digest
Perl-Users Digest, Issue: 1100 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Oct 17 13:05:30 1999
Date: Sun, 17 Oct 1999 10:05:07 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <940179907-v9-i1100@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sun, 17 Oct 1999 Volume: 9 Number: 1100
Today's topics:
Re: Annoying error: "Args must match #! line" (Kragen Sitaker)
DNS provisoning scripts <gopib@home.com>
Re: Do you now an affordable Perl editor for Windows NT (Jeff Schneider)
Re: email RegExp problem <suaai@csv.warwick.ac.uk>
Re: email RegExp problem (Kragen Sitaker)
Re: Exact pattern match <paschal1@mindspring.com>
Re: Exact pattern match (Abigail)
Re: Exact pattern match (Matthew Bafford)
Re: Exact pattern match <gellyfish@gellyfish.com>
file protection <ab@cd.com>
Re: GD module (Kragen Sitaker)
Re: hashes (Tad McClellan)
Re: How can I step by step to debug my perl program in (Kragen Sitaker)
Re: How to socket (Kragen Sitaker)
Re: I am a newbie and need help! (Kragen Sitaker)
Re: ied/fep in perl? (Kragen Sitaker)
Re: Needs Perl bindings done for new Corba environment <gellyfish@gellyfish.com>
Re: Needs Perl bindings done for new Corba environment (Brett W. McCoy)
Re: panic: leave_scope inconsistency (Ilya Zakharevich)
Re: Perl script taking regex as argument? (Kragen Sitaker)
Re: qr operator the $_ (Ilya Zakharevich)
Range checking (Henry Penninkilampi)
Re: recursive delete (Kragen Sitaker)
Re: retrieve url from hypertext (Tad McClellan)
Re: Uses of # (Kragen Sitaker)
Re: Where can I find the module GD for Windows servers? <gellyfish@gellyfish.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 17 Oct 1999 16:16:49 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Annoying error: "Args must match #! line"
Message-Id: <RDmO3.12188$E_1.669004@typ11.nn.bcandid.com>
In article <eli$9910152020@qz.little-neck.ny.us>,
Eli the Bearded <*@qz.to> wrote:
> $ ls -l index.cgi
> -rwsr-xr-x 1 eli www 8687 Oct 15 18:03 index.cgi
> $ perl -Twc index.cgi
> Args must match #! line at index.cgi line 1.
> $ head -1 index.cgi
> #! /usr/bin/perl -Tw
>
>I know BEGIN and END blocks get executed even when using the
>check mode (-c)
Hmm, if your script doesn't read standard input, you could tail +2
index.cgi | perl -Tw. In fact, it turns out you can even cat index.cgi
| perl -Twc.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Sun Oct 17 1999
23 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Sun, 17 Oct 1999 17:01:14 GMT
From: "Gopi Balasingam" <gopib@home.com>
Subject: DNS provisoning scripts
Message-Id: <uhnO3.17226$gm.217941@news1.rdc2.on.home.com>
Hi,
I was wondering if any one had any automatic DNS provisioning scripts ? I
would like to automate the creation of domains to a nameserver via default
provisioning scripts that update the DNS configuration file with the
required parameters.
Thank you.
Regards,
Gopi
------------------------------
Date: Sun, 17 Oct 1999 16:05:56 GMT
From: schneiderj@dmci.net (Jeff Schneider)
Subject: Re: Do you now an affordable Perl editor for Windows NT
Message-Id: <3809f3c4.12880779@news.dmci.net>
I like notetab lite
Jeff Schneider
>
>Matt King <mattking@techie.com> wrote in message
>news:7thmra$d0c$1@news.uk.ibm.com...
>> Why not just use the Windows notepad.exe? Works fine for me......
>>
>> Matt
>>
>>
>
>
------------------------------
Date: Sun, 17 Oct 1999 16:38:02 +0100
From: MTW <suaai@csv.warwick.ac.uk>
To: "Randal L. Schwartz" <merlyn@stonehenge.com>
Subject: Re: email RegExp problem
Message-Id: <Pine.GSO.4.10.9910171631170.29805-100000@mimosa.csv.warwick.ac.uk>
On 16 Oct 1999, Randal L. Schwartz wrote:
> >>>>> "MTW" == MTW <suaai@csv.warwick.ac.uk> writes:
>
> MTW> Hi -
> MTW> Wondering if anyone out there can improve on my user@host RE, so that it
> MTW> can catch foo.bar@host
>
> Catch it and do what? That's a perfectly legal email address!
>
> Read the FAQ. Know that you should not discriminate against addresses
> that are not alphanum on the left side, or bear the wrath of people
> trying to type their legitimate address, only to be rejected by an
> over-agressive validator.
I know - but I'm doing some code to be used internally at this university.
I already _know_ that the email addresses that I'll be finding will end
".warwick.ac.uk", but I need to extract John.Smith@dcs from
John.Smith@dcs.warwick.ac.uk, where the whole From: line that I'm
processing will be
Johnny Boy! <John.Smith@dcs.warwick.ac.uk>, or indeed
j.c.smith@dcs.war . . .
In other words, I know how to extract the first \w after the @ sign, but
how do I extract all the x.y.z.abc@ . . stuff before the @?
The only REs that I seem to be able to come up with don't work, because
they're being greedy and taking the x.y.z. inside a .*
cyl8a
jC
Music Theatre Warwick
write: c/o Music Centre, University of Warwick, Coventry CV4 7AL, England
mailto:mtw@warwick.ac.uk
http://www.warwick.ac.uk/society/mtw/
------------------------------
Date: Sun, 17 Oct 1999 16:00:36 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: email RegExp problem
Message-Id: <EomO3.11985$E_1.665347@typ11.nn.bcandid.com>
In article <Pine.GSO.4.10.9910171631170.29805-100000@mimosa.csv.warwick.ac.uk>,
MTW <suaai@csv.warwick.ac.uk> wrote:
>I know - but I'm doing some code to be used internally at this university.
>I already _know_ that the email addresses that I'll be finding will end
>".warwick.ac.uk", but I need to extract John.Smith@dcs from
>John.Smith@dcs.warwick.ac.uk, where the whole From: line that I'm
>processing will be
>
>Johnny Boy! <John.Smith@dcs.warwick.ac.uk>, or indeed
>j.c.smith@dcs.war . . .
>
>In other words, I know how to extract the first \w after the @ sign, but
>how do I extract all the x.y.z.abc@ . . stuff before the @?
How about /([\w.]+)\@(\w+)\.warwick\.ac\.uk/ for starters?
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Sun Oct 17 1999
23 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Sun, 17 Oct 1999 11:08:48 -0400
From: David Paschal <paschal1@mindspring.com>
Subject: Re: Exact pattern match
Message-Id: <3809E680.27A3582A@mindspring.com>
yes eq
if ($qfield eq /\b$aname/i );
if ($qfield eq $user ); #as suggested by --Matthew
I have tried it, but then the return is NO results.
The man pages are, and have been, open since 2am and will stay open
until the problem is solved.
Surprise, surprise, searching for answers from more than one source is
a good idea.
Old dogs like me, frequently need assistance when learning new tricks.
Thanks for your help, it was most assuredly well thought out and
totally enlightening.
Abigail wrote:
>
> ¿¤BaX¤¿ (paschal1@mindspring.com) wrote on MMCCXXXVIII September MCMXCIII
> in <URL:news:7uchtr$m2a$1@nntp8.atl.mindspring.net>:
> ^^ I'm trying to get an EXACT match for user names from a flat file,
>
> Surprise, surprise, there's an operator for this.
>
> The man page will tell you the details.
>
> Abigail
> --
> srand 123456;$-=rand$_--=>@[[$-,$_]=@[[$_,$-]for(reverse+1..(@[=split
> //=>"IGrACVGQ\x02GJCWVhP\x02PL\x02jNMP"));print+(map{$_^q^"^}@[),"\n"
>
> -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
> http://www.newsfeeds.com The Largest Usenet Servers in the World!
> ------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 17 Oct 1999 10:18:06 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Exact pattern match
Message-Id: <slrn80jq4q.q8s.abigail@alexandra.delanet.com>
David Paschal (paschal1@mindspring.com) wrote on MMCCXXXVIII September
MCMXCIII in <URL:news:3809E680.27A3582A@mindspring.com>:
<> yes eq
<>
<> if ($qfield eq /\b$aname/i );
<> if ($qfield eq $user ); #as suggested by --Matthew
<> I have tried it, but then the return is NO results.
Then the operands contain something else than you think they contain.
I suggest you print them out, and watch for any leading/trailing
whitespace. Perhaps one of them has a trailing newline?
Abigail
--
perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle'print +(
HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (
LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET",
"http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content))
=~ /(.*\))[-\s]+Addition/s) [0]'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Sun, 17 Oct 1999 15:20:41 GMT
From: *@dragons.duesouth.net (Matthew Bafford)
Subject: Re: Exact pattern match
Message-Id: <slrn80jkb2.2bb.*@dragons.duesouth.net>
Once upon a time (Sun, 17 Oct 1999 09:15:17 -0400), ¿¤BaX¤¿"
<paschal1@mindspring.com> was attempting to figure out Ilya's new Perl
regex features, and accidently sent the following to
comp.lang.perl.misc:
: I'm trying to get an EXACT match for user names from a flat file,
:
: @names = split(/ +/,$user);
: foreach $aname (@names) {
: if ($qfield =~ /\b$aname/i ) {
: &print_results;
: }
You want an EXACT match.
print_results() if $qfield eq $user;
: Dave
--Matthew
------------------------------
Date: 17 Oct 1999 14:37:38 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Exact pattern match
Message-Id: <7ucmvi$4vj$1@gellyfish.btinternet.com>
On Sun, 17 Oct 1999 09:15:17 -0400 "¿¤BaX¤¿" wrote:
> I'm trying to get an EXACT match for user names from a flat file,
> The (shamefully stolen) code that I'm using returns partial matches.
> Using this:
> ##################################################
> @names = split(/ +/,$user);
> foreach $aname (@names) {
> if ($qfield =~ /\b$aname/i ) {
> &print_results;
> }
> ##################################################
>
> A search for "SMITH, JOE"
>
> will return
> "SMITH, BOB"
> "SMITH, JOE"
> "SMITH, SUE ELLA"
>
> I need to get only the exact match "SMITH, JOE"
>
>
Er then use an equality operator rather than an regex:
while(<DATA>)
{
chomp;
printresults() if ($qfield eq $_ );
}
__END__
SMITH, BOB
SMITH, JOE
SMITH, SUE ELLA
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Sun, 17 Oct 1999 11:20:56 -0500
From: "Blair Heuer" <ab@cd.com>
Subject: file protection
Message-Id: <7uct1k$mev$1@oak.prod.itd.earthlink.net>
I am not sure whether this is completely a perl question, or more server
related, so if it is server related feel free to ignore it, or say so.
On Unix systems, I know that the flock() can be used to protect a file from
corruption, but how do you prevent this on a Windows system in perl? For
instance, if I were writing to my programs pref file from the administration
script, and someone was reading that file, wouldn't that corrupt it? If it
gets corrupt the whole system will go screwy. So, in summary, my question
is: How do I protect files with perl on Windows systems?
-Blair Heuer
------------------------------
Date: Sun, 17 Oct 1999 15:25:27 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: GD module
Message-Id: <HTlO3.11961$E_1.659585@typ11.nn.bcandid.com>
In article <Pine.A41.4.10.9910160407100.558946-100000@tigger.cc.uic.edu>,
Seth David Johnson <sjohns17@uic.edu> wrote:
>On Sat, 16 Oct 1999, Ron Seifenberger wrote:
>> is it possible to read the image information (like the size of a
>> gif-file) with the GD module?
>
>Yes, there are methods for this as well as for extracting rgb values of
>pixles (which you will need). I can't name the methods off the top of my
>head, but they're in the pod ( do a "perldoc pod" ).
>
>> And can I convert a image into another size?
>
>Yes. To enlarge, simply take the rgb value of each pixel and make a
>larger "block" of pixels with that value (I don't know any smoothing
>algorithms off-hand).
Better algorithms include antialiased blocking, linear interpolation,
and spline interpolation.
>The algorithm to shrink an image is basically the
>same as the "mosaic" (tiling) algorithm. You take the image
>block-by-block (the smaller you want the resulting image to be, the larger
>the block size), calculate an average red, green, and blue for each block.
>Then make a pixel (rather than a block, which is the case with the mosaic
>algorithm) with the resulting values.
That will certainly work (assuming your output device has a linear
response). A cruder and sometimes much faster method, which has the
additional advantage of not changing the palette used by a .gif, is to
simply drop entire rows and columns of the input image. Sometimes this
interacts badly with fixed dithering patterns, though, and it will
always interact badly with nonantialiased text.
If you do the block averaging thing, you should keep in mind that each
output block may contain a non-integer number of input pixels, and
accordingly, each input pixel may contribute to more than one output
block.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Sun Oct 17 1999
23 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Sun, 17 Oct 1999 04:36:51 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: hashes
Message-Id: <3r1cu7.2b8.ln@magna.metronet.com>
Frank Hale (frankhale@trespass.net) wrote:
: Martien Verbruggen wrote:
: >
: > On Sun, 17 Oct 1999 03:09:56 -0500,
: > Frank Hale <frankhale@trespass.net> wrote:
: > > Okay I got a hash which stores usernames with there login times. Problem
: > > is I don't want a duplicate key in the hash. For instance say user
: > > "john" logs in at 13:22 and then logs in again at 13:45, I don't want
: > > him in the hash 2 times.
But you don't say _which_ of the two times you want to keep.
: > > How can I test for this and
: > > only enter him in the list once?
: >
: > Use the username as a key.
Martien's suggestion will keep only the second login time.
: I am. It still allows the key to be in the hash.
If you want to keep the first login time, then check for it
when you add new values:
$logins{$name} = $login_time unless exists $logins{$name};
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 17 Oct 1999 15:19:18 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: How can I step by step to debug my perl program in emacs?
Message-Id: <WNlO3.11957$E_1.655481@typ11.nn.bcandid.com>
In article <e1UIOIS7Dt9KbFgpFVX68TSu7Mh1@4ax.com>,
Marcel Grunauer <marcel.grunauer@lovely.net> wrote:
>On Sat, 16 Oct 1999 14:44:04 +0800, "code" <codeboy@163.net> wrote:
>> Sorry if the question has been asked many times.But
>> I really has spent much time to do it by myself ,now
>> I need your help.I want to debug my perl program in
>> emacs.But I don't know what should i do after typing
>> ESC-x perldb <RET> ,if I input '~\program\per\test4.pl -e 0 ',
>> it go ahead than waitting I inputing the more command
>> like s to debug it.
So it just runs the program instead of allowing you to enter commands
such as 's' and 'n'? I think that's what you said but I'm not sure. I
think the string you're supposed to type is perl -d test4.pl -e 0. (It
normally runs in the working directory of the buffer you run it from.)
I tried doing this, and it worked reasonably well.
>It seems your question has more to do with cperl-mode than Perl,
No, it has nothing to do with cperl-mode at all.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Sat Oct 16 1999
24 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Sun, 17 Oct 1999 16:43:18 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: How to socket
Message-Id: <G0nO3.12293$E_1.673313@typ11.nn.bcandid.com>
In article <7u8nc9$hm8$1@kpt1000.hitel.net>, ÃÖÇö½Ä <choigo7@hitel.net> wrote:
> connect(SOCK, $paddr) || die "connect: $!";
> while (defined($line = <SOCK>)) {
> print $line;
> }
This will read lines from SOCK until end of file. End of file on a
socket happens when the other end closes the connection. So here's
what will happen:
1. you will read some lines from the socket.
2. you will run out of lines to read because the server will wait for
you to send something. Your script hangs.
3. eventually (15 minutes later?) the server will give up and close the
connection. your script will exit the loop and try to print to the
socket. this will probably have no useful effect.
The traditional and simple way to avoid this sort of deadlock is to
write half-duplex protocols like FTP, SMTP, NNTP, and early versions of
HTTP. In these protocols, the client and server both know who is
supposed to be talking at any given stage of the protocol, so you're
never both waiting for the other end to send something.
The more complex way -- necessary for e.g. pipelined SMTP, pipelined
HTTP, X, IRC, etc. -- is to do things in an event-driven way, usually
with select().
HTH.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Sun Oct 17 1999
23 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Sun, 17 Oct 1999 15:53:58 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: I am a newbie and need help!
Message-Id: <qimO3.11981$E_1.664477@typ11.nn.bcandid.com>
In article <7ucl9o$s6m$1@bgtnsc02.worldnet.att.net>, Jim <golf@tfz.net> wrote:
>I am uploading just to see if I can get it to work, but I am gettin an
>internal 500 error. Whats wrong with it?
Check your server error log. If you see, "Permission denied", that
means you need to give the world execute permission on the script. If
you see, "Command not found", that means perl is not in /usr/bin/perl.
If you see something else, post it.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Sun Oct 17 1999
23 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Sun, 17 Oct 1999 15:46:51 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: ied/fep in perl?
Message-Id: <LbmO3.11974$E_1.663217@typ11.nn.bcandid.com>
In article <7u7qhm$tnp$1@nnrp1.deja.com>, <kommu@hotmail.com> wrote:
>Do we have the ied tool (which is available on HP-UX) in perl? THere
>is a free version of it called fep, but the source code is not at all
>portable.
>
>I'm looking for a way to control interactive programs like bc, ftp or
>crash. I want to add history and such features to these programs.
>That's what exactly ied does.
Consider using Emacs's M-x shell.
>Is there a way I can implement this in
>perl?
Sure.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Sun Oct 17 1999
23 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: 17 Oct 1999 14:55:43 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Needs Perl bindings done for new Corba environment
Message-Id: <7uco1f$4vn$1@gellyfish.btinternet.com>
On Wed, 13 Oct 1999 02:05:07 GMT battery841@usa.net wrote:
> Hey,
> One of my friends, Bob, is working on a new Corba environment called
> BLADE. BLADE is a Corba based web page development environment. He
> needs someone to do Perl bindings for BLADE.
Have you looked at COPE ? There is a link to it from :
<http://www.perl.com/reference/query.cgi?corba>
I cant say anything else about it though ...
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Sun, 17 Oct 1999 16:46:48 GMT
From: bmccoy@foiservices.com (Brett W. McCoy)
Subject: Re: Needs Perl bindings done for new Corba environment
Message-Id: <slrn80jvk0.8sl.bmccoy@moebius.foiservices.com>
Also Sprach Jonathan Stowe <gellyfish@gellyfish.com>:
>On Wed, 13 Oct 1999 02:05:07 GMT battery841@usa.net wrote:
>> Hey,
>> One of my friends, Bob, is working on a new Corba environment called
>> BLADE. BLADE is a Corba based web page development environment. He
>> needs someone to do Perl bindings for BLADE.
>
>Have you looked at COPE ? There is a link to it from :
>
> <http://www.perl.com/reference/query.cgi?corba>
>
>I cant say anything else about it though ...
There are also bindings available for Mico as well.
--
Brett W. McCoy bmccoy@foiservices.com
Computer Operations Manager (Alpha Geek) http://www.foiservices.com
FOI Services, Inc./DIOGENES 301-975-0110
---------------------------------------------------------------------------
------------------------------
Date: 17 Oct 1999 16:35:18 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: panic: leave_scope inconsistency
Message-Id: <7ucts6$erv$1@charm.magnus.acs.ohio-state.edu>
[A complimentary Cc of this posting was sent to Jonathan Stowe
<gellyfish@gellyfish.com>],
who wrote in article <7ubuk9$3gh$1@gellyfish.btinternet.com>:
> > A cron job I have written (perl 5.00401) occasionally dies with the
> > error message:
> >
> > panic: leave_scope inconsistency
> >
>
> Upgrade your Perl.
Hmmm. Remember that Perl's between 5.005_58 (or around) and 5.005_61
show the same symptome? ;-)
Ilya
------------------------------
Date: Sun, 17 Oct 1999 15:29:40 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Perl script taking regex as argument?
Message-Id: <EXlO3.11967$E_1.659893@typ11.nn.bcandid.com>
In article <380946BC.2C06DD05@rice.edu>,
Gregory Stoll <gstoll@rice.edu> wrote:
>Hi all! I'm trying to write a little Perl script (haven't used Perl for
>very long), and I'd like to have it take a filename and a regex as
>arguments.
On the command-line, you mean?
>The problem is, perl tries to interpret the regex as a file
>and complains when it can't find it.
You're using <> for input?
If you don't mind having the regex as your first argument, you can
shift @ARGV. You can construct a whole new @ARGV from scratch if you
like, and then <> will use it.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Sun Oct 17 1999
23 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: 17 Oct 1999 16:41:15 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: qr operator the $_
Message-Id: <7ucu7b$esr$1@charm.magnus.acs.ohio-state.edu>
[A complimentary Cc of this posting was sent to Kragen Sitaker
<kragen@dnaco.net>],
who wrote in article <NwlO3.11934$E_1.655839@typ11.nn.bcandid.com>:
> It would be nifty if you could use the Japanese corner quote characters
> in Unicode Perl to do a qr without having to say "qr" -- the same way
> "" does qq, '' does q, and `` does qx without you having to specify
> it. Everybody who's read Friedl would go home happy. :)
Even with my user-defined-operators patch you cannot introduce new
quoting operators. Though if the need arises, it would not be *that*
difficult to add.
> BTW, the various quoting operators that use > to match <, ) to match (,
> and so forth -- do they recognize the various Unicode brackets, like
> the lenticular and tortoise-shell brackets? There's probably a more
> appropriate place to ask, right?
There are 4 such guys, {}, [], (), <>. I think keeping this list
short has some advantages.
On the other hand, it is indeed a legitimate question, I CC it to p5p:
once Unicode goes in, one would not be able to change matching rules.
So it should be at least *discussed* early.
Ilya
------------------------------
Date: Mon, 18 Oct 1999 01:46:17 +0930
From: spamfree@metropolis.net.au (Henry Penninkilampi)
Subject: Range checking
Message-Id: <spamfree-1810990146170001@d7.metropolis.net.au>
Greetings!
I'm currently testing for:
$min < $x <= $max
...in the predictable manner:
if (($min < $x) and ($x <= $max))
I was just wondering if anyone knows of a more succinct approach?
Henry.
------------------------------
Date: Sun, 17 Oct 1999 16:46:21 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: recursive delete
Message-Id: <x3nO3.12300$E_1.673760@typ11.nn.bcandid.com>
In article <BZTN3.3275$AX.172617@news1.rdc1.ab.home.com>,
Mike Watkins <mwatkins@promotion4free.com> wrote:
>Try this little bit of code which I wrote for a script I'm creating.
>$newdir is the directory which you want to delete, without the slash at the
>end, and the $rmdir variable is the location to the "rmdir" function, which
>on UNIX servers is usually located at "/bin/rmdir".
On Unix machines -- server or otherwise -- you should just use rm -rf.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Sun Oct 17 1999
23 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Sun, 17 Oct 1999 04:41:10 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: retrieve url from hypertext
Message-Id: <632cu7.2b8.ln@magna.metronet.com>
Howard Sun (hxshxs@my-deja.com) wrote:
: In article <7u9cg3$vmm$1@nnrp1.deja.com>,
: Howard Sun <hxshxs@my-deja.com> wrote:
: > just started learning Perl. not sure how to do the following,
: >
: > extract all URLs within the hypertext.
: >
: > if I use
: > if(/<a href="?.*"?>/) {
: > $link = $&;
: > }
: now I can get first URL by
: if($line=~/<a href=\"?(.*?)\"?>/i)
: {
: push (@link, "$1");
^ ^
^ ^
Those quotes serve no purpose, and actually get in the way
of understanding the code:
push (@link, $1);
: print @link, "\n";
: }
: But how do I get the second url on the same line $_ ? how to do the loop
: here?
1) change the if() to while().
2) add a m//g option to the pattern match
while ($line =~ /<a href=\"?(.*?)\"?>/gi)
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 17 Oct 1999 15:27:22 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Uses of #
Message-Id: <uVlO3.11964$E_1.659229@typ11.nn.bcandid.com>
In article <38097b0b@plato.netscapeonline.co.uk>,
beaumontsystems <beaumontsystems@netscapeonline.co.uk> wrote:
>I want to write a utility that takes a Perl script and compresses it to a
>single line
>(or a few lines), removing leading spaces on lines, all comments, etc.
>
>I will need to strip out comments that begin '#......', but are there any
>other uses
>of # ? I am aware of $# ... but are there any more ?
You want to parse Perl. Only perl can parse Perl, my friend.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Sun Oct 17 1999
23 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: 17 Oct 1999 15:13:56 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Where can I find the module GD for Windows servers?
Message-Id: <7ucp3k$4vs$1@gellyfish.btinternet.com>
On Sat, 16 Oct 1999 23:27:25 GMT John Armsby wrote:
> On 12 Oct 1999 16:18:52 +0100, Jonathan Stowe
> <gellyfish@gellyfish.com> wrote:
>
>>Craig <craig@free-inter.net> wrote:
>>> Anyone know where I could find GD for Win32?
>>>
>>
>>If you have Activestate perl then you can just do :
>>
>>PPM install GD
>>
>>At the command prompt.
>>
> Been there. Done that. GD and GIFgraph install great. They won't
> work because you need to install version 1.19 which supports GIF
> files. I have tried everything I can think of. No luck.
>
Hmm. I just read a post that implied that the latest version available
from Activestate was *at least* that version - I havent got Windoss
here to check unfortunately.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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.
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 V9 Issue 1100
**************************************