[7569] in Perl-Users-Digest
Perl-Users Digest, Issue: 1195 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Oct 19 04:07:17 1997
Date: Sun, 19 Oct 97 01:00:40 -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 Sun, 19 Oct 1997 Volume: 8 Number: 1195
Today's topics:
Cancelled posts in comp.lang.perl.misc (Danny Aldham)
Re: Clear end of line: how <ase@seanet.com>
Re: Date to integer (TessnRand)
Re: how would you write a cgi or perl that would do thi (brian d foy)
Re: IPC and FIFOs lvirden@cas.org
Mind sucking, time wasting regex reljr@sigg.com
Re: Mind sucking, time wasting regex (brian d foy)
Re: Most efficient way to parse large text files (Thomas Munn)
Re: Most efficient way to parse large text files (Bill Totten)
Newbie Climbing the Walls! (Rick Freeman)
Re: Newbie Climbing the Walls! (Michael)
Re: nvi (brian d foy)
Perl win32 problem with account with space <nuneze@ix.netcom.com>
Re: Please excuse this Win 32 question (EMarkert)
problem in JAVA exec of PERL scripts on Windows platfor <ajaym@hooked.net>
problem in JAVA exec of PERL scripts on Windows platfor <ajaym@hooked.net>
Professional web sites - Lowest rates - Free hosting <Vangeli@erols.com>
Re: Replacing anything not matching with s/? (Daniel S. Lewart)
rmtree bug in File::Path in NT ??? maverner@hotmail.com
Re: sorting a hash (brian d foy)
Re: Using undefined match results? (Tad McClellan)
Re: Using undefined match results? (Michael Schuerig)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 18 Oct 1997 18:21:57 -0700
From: danny@lennon.postino.com (Danny Aldham)
Subject: Cancelled posts in comp.lang.perl.misc
Message-Id: <62bnbl$aiv$1@lennon.postino.com>
I have noticed this afternoon that hundreds of posts to
this news group are being cancelled. I don't honor cancels
but I am sure most sites do. Attached is a sample cancel,
with headers intact.
>From lennon.postino.com!news.postino.com!noc.van.hookup.net!news.bctel.net!newsfeed.direct.ca!news.idt.net!psinntp!seattle.crossover.com Sat Oct 18 17:48:53 1997
Path: lennon.postino.com!news.postino.com!noc.van.hookup.net!news.bctel.net!newsfeed.direct.ca!news.idt.net!psinntp!seattle.crossover.com
Newsgroups: comp.lang.perl.misc
Date: Thu, 16 Oct 1997 20:14:34 -0400
Message-ID: <cancel.61toma$8bf$1@lennon.postino.com>
From: rgm@eyrie.org
Subject: cmsg cancel <61toma$8bf$1@lennon.postino.com>
X-Cancelled-By: rgm@eyrie.org
Control: cancel <61toma$8bf$1@lennon.postino.com>
X-No-Archive: Yes
Lines: 3
Xref: lennon.postino.com control:12900
The article was canceled on 10/16/97 at 8:04:55 PM with the Usenet Cancel Engine (UCE).
--
Danny Aldham SCO Ace , MCSE , JAPH , DAD
I wak'd, she fled, and day brought back my night. jm
------------------------------
Date: Sat, 18 Oct 1997 22:30:49 -0700
From: "Allen Evenson" <ase@seanet.com>
Subject: Re: Clear end of line: how
Message-Id: <62c5tg$iqq@q.seanet.com>
=20
Jean-Louis Leroy wrote in article ...
>Hello,
>
>how can I clear the end of the line in a console (aka terminal) window=20
>with perl-win32 under NT? If there's a portable way it's even better.=20
>TIA.
>
>Jean-Louis Leroy
>http://ourworld.compuserve.com/homepages/jl_leroy
>
If your using ansi.sys then
print "\e[K";
should work.
Hope that helps.
-----------------------------------
Allen
------------------------------
Date: 19 Oct 1997 07:28:41 GMT
From: tessnrand@aol.com (TessnRand)
Subject: Re: Date to integer
Message-Id: <19971019072801.DAA27096@ladder02.news.aol.com>
I'm programming an AppZ under Linuxthat will handle dates.
The thing I would like to do is to is to convert the date to an integer.
Ex:
Mon Oct 13 22/58:13 MET DST 1997
would be converted into:
19971310
Has any one already programmed this & ?
Yours
REPLY:
try the function "localtime" - it returns a string of integers that can be used
to derive just such a thing
@curDate = localtime;
print $curDate[5], $('00'..'31')[$curDate[4]], $('01'..'12')[$curDate[3]];
that should work(I think), but the year will only be two digits.
Rand
------------------------------
Date: Sun, 19 Oct 1997 01:39:02 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: how would you write a cgi or perl that would do this..
Message-Id: <62bmif$t61@bgtnsc01.worldnet.att.net>
In article <3449229B.20D1@interlog.com>, paradigm@interlog.com wrote:
> When a specific icon (or hot link) is clicked on a page a counterfile
> gets incremented in a spcific directory (lets say clicklogs).
>
> Once this is done the program goes into the clicklogs directory and
> finds out which log files has the most hits.(according to the
> incremental counterfile)
how about using dbm or some other database thingy? that would be
much easier than searching through a bunch of files.
> How hard is this to do?
depends on who's doing it ;) your biggest concern would be to keep
different processes from stomping all over each other's data if they
try to update the database at the same time.
> Please E-mail me with your responses.
please feel free to participate in the community...
good luck :)
--
brian d foy <http://computerdog.com>
#!/usr/bin/perl
$_=q|osyrNewkecnaYhe.mlorsePptMskurj|;s;[NY.PM]; ;g;local$\=
qq$\n$;@pm=split//;while($NY=pop @pm){$pm.=$NY;$ny.=pop @pm}
$pm=join'',reverse($ny,$pm);open(NY,'>&STDOUT');print NY $pm
------------------------------
Date: 19 Oct 1997 02:46:55 GMT
From: lvirden@cas.org
Subject: Re: IPC and FIFOs
Message-Id: <62bsav$sgo$1@srv38s4u.cas.org>
According to I hate SPAM <fred@foobar.com>:
:-=-=-=-=-=-
:
:Ok, since no one responded to my question about threads and Perl, I am
:going to assume that Perl has no support for multiple threads of control
Why not assume that you just haven't seen the answers yet?
Perl has threads - in development . See Perl 4.004.53 or 54 for the
code.
--
Larry W. Virden INET: lvirden@cas.org
<URL:http://www.teraform.com/%7Elvirden/> <*> O- "We are all Kosh."
Unless explicitly stated to the contrary, nothing in this posting should
be construed as representing my employer's opinions.
------------------------------
Date: Sat, 18 Oct 1997 21:37:19 -0600
From: reljr@sigg.com
Subject: Mind sucking, time wasting regex
Message-Id: <877227463.32725@dejanews.com>
You know, sometimes I just get stubborn and won't stop beating a dead
horse. A regex question was posted Oct. 10 1997, and there were several
answers posted, but I didn't like any of them (imagine that). So I posted
an answer and later decided that I didn't like it either.
I pondered the mystery of this regex beast until I got the answer today.
One of my many thoughts about this regex is that I don't like the
non greedy quantifier system in perl. There is no way to limit what it
will look for on the righthand side of the expression except by limiting
the total expression itself. To solve this regex so that it would pass
all of the tests I was forced to place the *?)+ business into the regex.
So what's my reason for posting? Hell I don't have any good reason for it
except perhaps to ask if there isn't a better way to do this that will
pass the string test below.
$string=
qq{
<H3>Title 1</H3>
ipsum <i>lorem</i>...
<a href="abc.html">qwerty</a>
<H3>Skip 1</H3>
multiple lines of <b>text</b> and tags...
<H3>Skip 2 </H3>
multiple lines of <b>text</b> and tags...
<H3>Title <tt><H3></H3>
What's the right answer here?
I can't say for sure, but I like it.
more text and <b>tags</b>...
<a href="def.html">asdfg</a>
<H3> <tt> Title 3</H3>
more text and <b>tags</b>...
<a href="ghi.html">asdfg</a>
<H3>Title 4</H3>
more text and <b>tags</b>...
<a href="jkl.html">asdfg</a>
<H3>Skip 3</H3>
multiple lines of <b>text</b> and tags...
<H3>Skip 4</H3>
multiple lines of <b>text</b> and tags...
};
while ($string =~
m{(?:<H3>(.*?)</H3>(?:(?!<H3>.*?</H3>).)*?)+<a\shref=(.*?)>}igs)
{
print qq{Header "$1"\tReferences $2\n};
}
-- reljr@sigg.com
Robert Lee
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: Sun, 19 Oct 1997 04:36:31 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Mind sucking, time wasting regex
Message-Id: <62c0v8$r43@bgtnsc02.worldnet.att.net>
In article <877227463.32725@dejanews.com>, reljr@sigg.com wrote:
> You know, sometimes I just get stubborn and won't stop beating a dead
> horse.
some of us like dead horses ;)
> I pondered the mystery of this regex beast until I got the answer today.
so what's your answer?
> One of my many thoughts about this regex is that I don't like the
> non greedy quantifier system in perl. There is no way to limit what it
> will look for on the righthand side of the expression except by limiting
> the total expression itself.
um, several of the answers demonstrated ways to do this. perhaps you
could elaborate on your dissatisfaction of those answers?
as for a workable solution, just about everyone advised not using a
regex on the entire file (i.e. splitting on <h3>, then playing with
smaller peices). did you not like that solution either?
--
brian d foy <http://computerdog.com>
#!/usr/bin/perl
$_=q|osyrNewkecnaYhe.mlorsePptMskurj|;s;[NY.PM]; ;g;local$\=
qq$\n$;@pm=split//;while($NY=pop @pm){$pm.=$NY;$ny.=pop @pm}
$pm=join'',reverse($ny,$pm);open(NY,'>&STDOUT');print NY $pm
------------------------------
Date: Sun, 19 Oct 1997 01:09:34 GMT
From: munn@bigfoot.com (Thomas Munn)
Subject: Re: Most efficient way to parse large text files
Message-Id: <62bmkt$1uj$1@nu-informer.alliance.net>
Here is the code for the previous post:
So Far, it is just supposed to turn this line:
Thu Oct 16 00:00:15 EDT 1997
and turn it into 10/16/97 (which it does)
Finally, The second part (so far) takes this line
Bytes Sent: 107968967 bytes
and assigns the # to BytesSent.
I ran it on the HUGE textfile (300+K) and the intrepreter kept cycling:
Use of uninitialized value at monthchanger.pl line 28, <> chunk 5.
Use of uninitialized value at monthchanger.pl line 31, <> chunk 5.
Use of uninitialized value at monthchanger.pl line 34, <> chunk 5.
Use of uninitialized value at monthchanger.pl line 38, <> chunk 5.
Use of uninitialized value at monthchanger.pl line 42, <> chunk 5.
Use of uninitialized value at monthchanger.pl line 45, <> chunk 5.
Use of uninitialized value at monthchanger.pl line 48, <> chunk 5.
Use of uninitialized value at monthchanger.pl line 51, <> chunk 5.
Use of uninitialized value at monthchanger.pl line 51, <> chunk 5.
Code Follows:
#!/usr/bin/perl -w
while (<>) {
if (/Mon|Tue|Wed|Thu|Fri|Sat|Sun|/) {
@fields = split(/ /,$_);
$DayOfMonth=$fields[2];
$Year= $fields[5];
$Year =~ s/19//;
if ($fields[1] eq "Oct") {
$Month=10;
}
if ($fields[1] eq "Nov") {
$Month=11;
}
if ($fields[1] eq "Dec") {
$Month=12;
}
if ($fields[1] eq "Jan") {
$Month=1;
}
if ($fields[1] eq "Feb") {
$Month=2;
}
if ($fields[1] eq "Mar") {
$Month=3;
}
if ($fields[1] eq "Apr") {
$Month=4;
}
if ($fields[1] eq "May") {
$Month=5;
}
if ($fields[1] eq "Jun") {
$Month=6;
}
if ($fields[1] eq "Jul") {
$Month=7;
}
if ($fields[1] eq "Aug") {
$Month=8;
}
if ($fields[1] eq "Sep") {
$Month=9;
}
$OutPutDate=$Month . "/" . $DayOfMonth . "/" . $Year;
print $OutPutDate;
}
if ("Bytes Sent") {
$_ =~ s/\s{2,}//;
#print $_;
@fields = split(/ /,$_);
$BytesSent = $fields[2];
print $BytesSent
}
}
------------------------------
Date: 19 Oct 1997 03:48:54 -0400
From: biell @ udel . edu (Bill Totten)
Subject: Re: Most efficient way to parse large text files
Message-Id: <62ce16$fm4$1@copland.udel.edu>
In article <62bmkt$1uj$1@nu-informer.alliance.net>,
Thomas Munn <munn@bigfoot.com> wrote:
<...>
>Code Follows:
> if (/Mon|Tue|Wed|Thu|Fri|Sat|Sun|/) {
^^ Every line contains the empty string!
> $Year =~ s/19//;
^^ Have you heard about the year 2000 problem yet?
> if ($fields[1] eq "Oct") {
> $Month=10;
> }
^^ This case-like thing hurts my eyes.
<...>
> if ("Bytes Sent") {
^ Don't you want '/'s, not '"'s? Although m"Bytes Sent" is ok.
<...>
Here is something *I* like better:
#!/usr/bin/perl -w
%months=('Jan', 1, 'Feb', 2, 'Mar', 3, 'Apr', 4, 'May', 5, 'Jun', 6,
'Jul', 7, 'Aug', 8, 'Sep', 9, 'Oct', 10, 'Nov', 11, 'Dec', 12);
while(<>) {
chomp;
if(m/Mon|Tue|Wed|Thu|Fri|Sat|Sun/) {
@fields=split(/ /);
$DayOfMonth=$fields[2];
$Year=$fields[5];
$Year=~s/^..//; #I'd prefer to ditch this and keep 4 digit dates.
$Month=$months{$fields[1]};
$OutPutDate="$Month/$DayOfMonth/$Year";
print $OutPutDate, " ";
}
if(m/Bytes Sent/) {
s/\s{2,}/ /;
@fields=split(/ /);
$BytesSent=$fields[2];
print $BytesSent, "\n";
}
}
--
Totten, William David (Bill) Computer and Information Science Major
totten @ pobox . com University of Delaware (Newark, DE; USA)
http://pobox.com/~totten/ Friends don't let friends use emacs
------------------------------
Date: Sat, 18 Oct 1997 23:37:24 GMT
From: Rick@MarinWeb.com (Rick Freeman)
Subject: Newbie Climbing the Walls!
Message-Id: <3449474f.4292375@nntp2.ba.best.com>
I'm pretty new at this, but I feel like I've really looked this code
over. Still, it doesn't work. I don't think the pattern in the IF
statement is matching -- even when I expect it to.
Please show me the error of my ways -- I've wasted a lot of time with
this already!
foreach $line (@file) {
if (/<!--$id-->/o) {
$line =~ s/<!--$id-->.*<!--f-->/<!--$id-->$copy<!--f-->/;
print FILE "$line";
$changescheck = 1;
}
else {
print FILE "$line";
}
}
Thanks in advance!
Rick
------------------------------
Date: 19 Oct 1997 00:05:09 GMT
From: dmmartn@ix.netcom.com (Michael)
Subject: Re: Newbie Climbing the Walls!
Message-Id: <62birl$dfb@dfw-ixnews10.ix.netcom.com>
In article <3449474f.4292375@nntp2.ba.best.com>, Rick@MarinWeb.com says...
>Please show me the error of my ways -- I've wasted a lot of time with
>this already!
The most ovbious problem I can see is that since you declared $line the temp
var you need to replace line number 2 (if (/<!--$id-->/o) {) with this:
if ($line =~ m/<!--$id-->/o) { so that perl knows to look in the $temp var
instead of the $_ var. I'm assuming $copy is defined and FILE is open with
write permisions set (both in chmod and with the open() command). If not that
would be a problem. Beyond that I can't see anything. If doing what I said
didn't solve the promlem, try using some die() statements in your code so you
can track down where the bug(s) are.
HTH
Philip
------------------------------
Date: Sun, 19 Oct 1997 01:52:29 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: nvi
Message-Id: <62bnbm$t61@bgtnsc01.worldnet.att.net>
In article <01bcdb11$6bc79460$b5910a9f@aurora.cna.com>, "Aaron"
<aaron@soltec.net> wrote:
> Hi
>
> I heard about a piece of software called NVI. So, I downloaded it and
> installed it. The thing is, I have absolutely no documentation for it.
>
> I've heard that it is a great help for people who like to PERL in VI.
hmmm... mine came with an *entire* docs directory:
sri[5] cd nvi-1.76
sri[6] ls
FAQ catalog db perl_scripts tk
LAYOUT cl docs recover vi
LICENSE clib ex regex
README common include tcl_api
build curses perl_api tcl_scripts
sri[7] ls docs
TODO changelog features internals spell.ok
USD.doc ev help interp tutorial
--
brian d foy <http://computerdog.com>
#!/usr/bin/perl
$_=q|osyrNewkecnaYhe.mlorsePptMskurj|;s;[NY.PM]; ;g;local$\=
qq$\n$;@pm=split//;while($NY=pop @pm){$pm.=$NY;$ny.=pop @pm}
$pm=join'',reverse($ny,$pm);open(NY,'>&STDOUT');print NY $pm
------------------------------
Date: 18 Oct 1997 23:44:33 GMT
From: "nuneze" <nuneze@ix.netcom.com>
Subject: Perl win32 problem with account with space
Message-Id: <01bcdc1f$5d692500$3aaf20cc@nunez>
Iam new to perl and I perl, version 5.003_07
I am running this program
use Win32::NetAdmin;
$user = 'Administrator';
if (Win32::NetAdmin::UsersExist('',$user)) { print "$user exists."; }
this works fine but when I use a name with a space in the middle such as
'Joe Blogs' nothing comes back but I know the user does exist, but when I
use another user like Guest it does work. I know we have a domain and that
account can login with an NT machine.
------------------------------
Date: 19 Oct 1997 01:22:30 GMT
From: emarkert@aol.com (EMarkert)
Subject: Re: Please excuse this Win 32 question
Message-Id: <19971019012201.VAA00840@ladder02.news.aol.com>
Yeah,
Goto ftp://ftp.cygnus.com/pub/gnu-win32/latest and pick up the usertools.exe
file. Lots of unix utils for Win32. NT port of the UNIX find command is only
one of the utils.
------------------------------
Date: Sat, 18 Oct 1997 23:15:35 -0700
From: Ajay Mittal <ajaym@hooked.net>
Subject: problem in JAVA exec of PERL scripts on Windows platforms
Message-Id: <3449A587.5977@hooked.net>
hello!
i m writing a JAVA GUI around some PERL scripts. The PERL scripts
make lots of native calls to some native executabes (don't ask me why!).
here is an example
java code:
Process p = runtime.exec ("perl xx.pl");
(after this i get OutputStream of the process to read
what this process is writing to STDOUT)
sample PERL code (xx.pl)
$xx = `ping 199.199.199.2`;
print $xx;
on UNIX i get the proper return strings in OutputStream of the process.
but on NT i noticed PING runs in a seperate command window and
i don't get anything in the output stream. is it because PERL was
not lauched from a command window? i noticed if i say
exec ("cmd32 perl xx.pl") then PING does not go out to a
separate command window but still i don't get anything on the
STDOUT. i know you are saying - why don't you write STDOUT
to a file and the later read it...b'cos i want to display
the output in GUI line-by-line and also there are tons of
such calls.
please help!
thanx
-ajay
------------------------------
Date: Sat, 18 Oct 1997 23:17:53 -0700
From: Ajay Mittal <ajaym@hooked.net>
Subject: problem in JAVA exec of PERL scripts on Windows platforms
Message-Id: <3449A611.F69@hooked.net>
hello!
i m writing a JAVA GUI around some PERL scripts. The PERL scripts
make lots of native calls to some native executabes (don't ask me why!).
here is an example
java code:
Process p = runtime.exec ("perl xx.pl");
(after this i get OutputStream of the process to read
what this process is writing to STDOUT)
sample PERL code (xx.pl)
$xx = `ping 199.199.199.2`;
print $xx;
on UNIX i get the proper return strings in OutputStream of the process.
but on NT i noticed PING runs in a seperate command window and
i don't get anything in the output stream. is it because PERL was
not lauched from a command window? i noticed if i say
exec ("cmd32 perl xx.pl") then PING does not go out to a
separate command window but still i don't get anything on the
STDOUT. i know you are saying - why don't you write STDOUT
to a file and the later read it...b'cos i want to display
the output in GUI line-by-line and also there are tons of
such calls.
please help!
thanx
-ajay
------------------------------
Date: Sat, 18 Oct 1997 22:45:29 -0400
From: "Vangeli Dermatis" <Vangeli@erols.com>
Subject: Professional web sites - Lowest rates - Free hosting
Message-Id: <62bscq$rgs@winter.news.erols.com>
This is a multi-part message in MIME format.
------=_NextPart_000_0032_01BCDC17.88BEDEA0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Crystal Vision is a premier web publishing and hosting service helping =
Individuals=20
and existing companies launch and implement a professionally designed =
web site.
=20
Your web site will be developed using rich graphics, 3D animation=92s =
and the latest=20
in programming languages like Html, Java, JavaScript and perl.=20
Crystal Vision will then host your site for FREE on one of our fast and =
reliable servers=20
featuring T3 technology. The same servers used to host our own web site. =
Take a look=20
at our work at Http://www.crystalvision.net and decide for yourself or =
visit=20
http://www.crystalvision.net/contact.html for a free NO OBLIGATION =
proposal.
If you have any questions please feel free to contact me at:
webmaster@crystalvision.net
------=_NextPart_000_0032_01BCDC17.88BEDEA0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">
<HTML>
<HEAD>
<META content=3Dtext/html;charset=3Diso-8859-1 =
http-equiv=3DContent-Type>
<META content=3D'"MSHTML 4.71.1712.3"' name=3DGENERATOR>
</HEAD>
<BODY>
<DIV>Crystal Vision is a premier web publishing and hosting service =
helping=20
Individuals <BR>and existing companies launch and implement a =20
professionally designed web site.<BR> <BR>Your web site will be =
developed using=20
rich graphics, 3D animation’s and the latest <BR>in programming =
languages=20
like Html, Java, JavaScript and perl. </DIV>
<DIV> </DIV>
<DIV>Crystal Vision will then host your site for <STRONG><U><EM>FREE=20
</EM></U></STRONG>on one of our fast and reliable servers <BR>featuring =
T3=20
technology. The same servers used to host our own web site. Take a look =
<BR>at=20
our work at <A=20
href=3D"http://www.crystalvision.net">Http://www.crystalvision.net</A> =
and decide=20
for yourself or visit <BR><A=20
href=3D"http://www.crystalvision.net/contact.html">http://www.crystalvisi=
on.net/contact.html</A>=20
for a free NO OBLIGATION proposal.</DIV>
<DIV><BR>If you have any questions please feel free to contact me=20
at: </DIV>
<DIV><A=20
href=3D"mailto:webmaster@crystalvision.net">webmaster@crystalvision.net</=
A><BR> </DIV></BODY></HTML>
------=_NextPart_000_0032_01BCDC17.88BEDEA0--
------------------------------
Date: 19 Oct 1997 06:51:18 GMT
From: d-lewart@uiuc.edu (Daniel S. Lewart)
Subject: Re: Replacing anything not matching with s/?
Message-Id: <62cal6$s86$1@vixen.cso.uiuc.edu>
"Mattias Lvnnqvist" <mattias.lonnqvist@uidesign.se> writes:
> I am trying to replace anything not matching a-z, A-Z, blank/space with
> nothing, eg getting a resulting string with only these chars.
> The following snippet is where I attempt to do it.
> ...
> So, I guess I am looking for a not operator that can be used in the
> regex. I tried s/![\w]+//g but that didnt do the trick.
> I've already tried checking perlsyn & perlop, with no success.
Perl regular expressions are, oddly enough, in perlre(1). If you had
read perlop(1) carefully, you would have encountered the tr/// and y///
operators. Here is one way to do it:
foreach (split(/\n/, $wholist)) {
tr/a-zA-Z //cd; #strip out so only a-z, A-Z & blank remains
@words = split();
print "@words\n"; #do something with words
}
Daniel Lewart
d-lewart@uiuc.edu
------------------------------
Date: Sun, 19 Oct 1997 00:36:12 -0600
From: maverner@hotmail.com
Subject: rmtree bug in File::Path in NT ???
Message-Id: <877238319.8613@dejanews.com>
I am using perl version 5.004_02 on Windows NT and trying
to remove an entire directory. I make the call
rmtree("c:/mydir", 0 , 1) in my perl file. Sometimes this works but
sometimes I get an infinite loop with the following messages:
Can't unlink file C:/mydir/temp.tst: Permission denied
at c:\perltest\doit.perl line 63
Can't unlink file C:/mydir/temp.tst: Permission denied
at c:\perltest\doit.perl line 63
Can't unlink file C:/mydir/temp.tst: Permission denied
at c:\perltest\doit.perl line 63
.
.
.
Does anyone have any clues about what is going on and how to
fix this?
Thanks
Matt
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: Sun, 19 Oct 1997 01:32:38 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: sorting a hash
Message-Id: <62bm6f$t61@bgtnsc01.worldnet.att.net>
In article <62bc0p$c29@winter.news.erols.com>, shodan@shodan.erols.com
(Dave Schenet) wrote:
> Bob Fawcett (bfawcett@myriad.com) wrote:
> : David Siebert wrote:
>
> : > I am trying to sort an array of keys to out put to a file.
> : > this does not work. What will?
> : > foreach $key sort((keys %myerror)) {print FILE "$key\t$value"}
>
> Missing semicolon after print statement.
the last statement in a block does not need the semicolon. the problem
is the placement of the `sort'
> I prefer:
>
> while (($key, $value) = each (%myerror)) {print (FILE "$key\t$value");}
but that doesn't slice, dice, or sort...
--
brian d foy <http://computerdog.com>
#!/usr/bin/perl
$_=q|osyrNewkecnaYhe.mlorsePptMskurj|;s;[NY.PM]; ;g;local$\=
qq$\n$;@pm=split//;while($NY=pop @pm){$pm.=$NY;$ny.=pop @pm}
$pm=join'',reverse($ny,$pm);open(NY,'>&STDOUT');print NY $pm
------------------------------
Date: Sat, 18 Oct 1997 18:21:01 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Using undefined match results?
Message-Id: <t8gb26.bm2.ln@localhost>
Michael Schuerig (uzs90z@ibm.rhrz.uni-bonn.de) wrote:
: I recently switched from 5.002 to 5.004 and have to cope with some
: problems.
: I have a piece of code like this:
: $path =~ m,^(.*/)(.+?)(#.*)?$,;
: $path = $1 . substr($2, 0, $max_base_len) . $3;
: Now, when one of the brackets matches nothing Perl complains in the next
^^^^^^^^^^^^^^^
<nit>
None of your parenthesis _can_ "match nothing".
They each require at least one character.
$1 must have a slash (solidus)
$2 must have any char except newline
$3 must have a hash (pound, crosshatch...)
It is possible, since you've made one optional, that a set of parens
will not match at all though.
"Not matching" is not the same as "matching nothing".
You have a "not matching" case above ($n var would be defined to
be the null string if it "matched nothing", it would not be undefined).
</nit>
: line about use of an uninitialized variable. Does this mean I have to
: guard each and every use of $1 et al. with an if?
That's pretty much it. Painful, but It Is Good For You ;-)
However, for your usage above, $3 is the only one that could possibly
be undefined if the m,, matched at all.
[ BTW, why are you not checking to see if the match even matched or not? ]
if ($path =~ m,^(.*/)(.+?)(#.*)?$,) {
$path = $1 . substr($2, 0, $max_base_len);
$path .= $3 if defined($3);
}
else { # <A HREF="foobar.html"> might occur in your data?
print "URL has no slash, or is the string '/'\n"; # ;-)
}
[
Ignore this part if you are not shortening filenames in URLs.
Looks to me like that is what you're doing...
You also realize, of course, that if two filenames are not unique
within $max_base_len characters that your script will be changing
*where the link is pointing*?
]
--
Tad McClellan SGML Consulting
tadmc@flash.net Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 19 Oct 1997 05:21:28 +0200
From: uzs90z@ibm.rhrz.uni-bonn.de (Michael Schuerig)
Subject: Re: Using undefined match results?
Message-Id: <1997101905075511462640N@rhrz-isdn3-p51.rhrz.uni-bonn.de>
Tad McClellan <tadmc@flash.net> wrote:
> Michael Schuerig (uzs90z@ibm.rhrz.uni-bonn.de) wrote:
> : Does this mean I have to
> : guard each and every use of $1 et al. with an if?
>
>
> That's pretty much it. Painful, but It Is Good For You ;-)
Well, then I'll have to do it.
> [ BTW, why are you not checking to see if the match even matched or not? ]
Just didn't think of it as I was sure that the whole expr would always
match. Anyway, I'll put that in.
> [
> Ignore this part if you are not shortening filenames in URLs.
> Looks to me like that is what you're doing...
Yes, indeed. I'm munging javadocs into a hierarchical form that is more
usable on the Mac with its 31 chars filename limit. (The docs should
have been hierarchical from the start!)
> You also realize, of course, that if two filenames are not unique
> within $max_base_len characters that your script will be changing
> *where the link is pointing*?
Of course, but it hasn't been a problem in practice, so far. I'll go for
a more robust solution when the need arises. If I'm lucky, the file
system has changed by then...
Thanks,
Michael
--
Michael Schuerig Most people would rather die than think.
mailto:uzs90z@uni-bonn.de In fact, they do.
http://www.uni-bonn.de/~uzs90z/ -Bertrand Russell
------------------------------
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 1195
**************************************