[24234] in Perl-Users-Digest
Perl-Users Digest, Issue: 6426 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Apr 19 18:06:00 2004
Date: Mon, 19 Apr 2004 15: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)
Perl-Users Digest Mon, 19 Apr 2004 Volume: 10 Number: 6426
Today's topics:
"Bizarre copy of array in aassign" <john@newchester.com>
Call for an Impeachment Inquiry of Bush and Cheney <editor@juno.com>
Call for an Impeachment Inquiry of Bush and Cheney <dale@webeye.freeserve.co.uk>
Re: foreach loop test (christie)
Re: LWP::Simple and utf8 problem <john@newchester.com>
Re: One question <edgrsprj@ix.netcom.com>
Re: pass in array or list of files <jgibson@mail.arc.nasa.gov>
Re: Perl is the answer? <ittyspam@yahoo.com>
Re: Perl is the answer? <xx087@freenet.carleton.ca>
Re: Perl is the answer? <jtc@shell.dimensional.com>
Re: Perl is the answer? (Lack Mr G M)
Re: Perl is the answer? <jds@nospantrumpetweb.co.uk>
Request for program test on different operating sytsems <edgrsprj@ix.netcom.com>
Re: Request for program test on different operating syt <edgrsprj@ix.netcom.com>
Selective deletion from symbol table? <jkrugman@yahbitoo.com>
Re: Selective deletion from symbol table? <skuo@mtwhitney.nsc.com>
Re: Selective deletion from symbol table? <jkrugman@yahbitoo.com>
stupid regexp question <slinberg@crocker.com>
Re: stupid regexp question <skuo@mtwhitney.nsc.com>
Re: Win32::Console with perl2exe -gui (PRSoftware)
Re: Win32::Console with perl2exe -gui <ittyspam@yahoo.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 19 Apr 2004 13:19:53 -0500
From: "John" <john@newchester.com>
Subject: "Bizarre copy of array in aassign"
Message-Id: <c61589$ko0$1@news.f.de.plusline.net>
After upgrading from Activestate Perl 5.6 to 5.8.3, I started getting these
errors when I used "croak."
Bizarre copy of HASH in sassign at C:/perl/lib/Carp/Heavy.pm line 47,
<GEN43> line 23.
This is frustrating, because in a big problem, it doesn't tell me what line
is generating the problem. It seems the only solution is to replace all the
croak statements throughout my very large program into die statements.
Anybody know how to deal with this?
------------------------------
Date: Mon, 19 Apr 2004 20:52:18 GMT
From: Bruce Morgen <editor@juno.com>
Subject: Call for an Impeachment Inquiry of Bush and Cheney
Message-Id: <b0209374.8b34d427@host-69-48-73-244.roc.choiceone.net>
Call for an Impeachment Inquiry of Bush and Cheney,
Get Congress to Take Action
Sign our online Petition and read below for more information:
http://www.votenader.org/get_involved/impeach.php
HEY DUDE WHERE'S MY BUDDY!!!???
COME BACK HOME MICHAEL!!!
Ok Michael, you've had your realpolitik fling with ex-General Wesley
Clark. Your endorsed Presidential candidate in the Democratic Primaries
has withdrawn. It is time for you to come home, to join your buddies and
resume your only genuine role which is that of defiance and resistance.
Compliance and assistance with the Democrats does not accord with your
past, your character, your bold writings and, most memorably, your long
corrosive assaults on the Party that betrayed the working classes and
plunged our country into corporate globalization. Remember, Michael,
you're the flinty man from Flint, Michigan. You've never forgotten your
roots. The heady Hollywood, Manhattan scene with the celebrities and
Academy Awards have never gotten to your head but rather have gotten
into your deserving pockets. How we all recall your standing before one
billion people in Los Angeles at the televised Academy Awards in 2003
and, breaking the customary cant of the awardees, throwing the gauntlet
down to George W. Bush and his "fictitious" war mongering.
Now the War has become a quagmire, with both Republicans and Democrats
complicit (check the votes in Congress). The Draft may be on the way. So
what are you doing going on the Al Franken Show very nearly breaking
down when Al Gore (he of the pro NAFTA/GATT, anti-worker, regime-change,
Iraq-bombing, lethal sanctions on half a million children
Administration) called and thought you were apologizing. You have
nothing to apologize for, Michael. Gore has a lot to apologize
for-blowing the election he won in Florida and the country as a whole
and for blowing, with Bill Clinton, the many opportunities the
rich-booming Nineties and the collapse of the Soviet Union gave this
country to turn a peace dividend into a pro-worker, pro-environment,
pro-consumer and anti-poverty resurgence.
Come back and join our Presidential campaign, Michael. Talk to those
"Reagan Democrats"-those 35% of union members who still vote Republican
and against their own interests-as only you can. Michael, if you go
pumping for the Democratic Party this year, just what are you going to
say to the unemployed steelworkers near Sparrows Point in Maryland? To
the megathousands of laid off textile and furniture workers in North and
South Carolina? To the abandoned auto workers waiting and waiting near
their empty factories that went to repressive countries? To the millions
of blue-collar workers, who fought our wars, only to learn that the two
parties won't fight for their company pensions and health insurance? Are
you going to tell them how the Democratic Party pushed through the WTO,
let their pensions erode or disappear, were too busy collecting checks
from the corporate bosses to pay attention to the corporate crime wave
that looted and drained trillions of dollars from millions of workers,
their retirement and small investments? Will you tell them that the
cowardly Democrats, who couldn't win the fewer elections they are now
not losing without the labor vote, won't even mount a determined drive
to repeal the notorious, union-blocking Taft Hartley Act?
How can you be free to be what you are, or to depress Bush's vote, to
jolt into consciousness the moribund Democratic Party?
Hey Dude, join your real buddies! The ones you may be thinking about
just don't fit either your message, your vision, or our website
VoteNader.org.
Come back home Michael. The workers and the youth of America are looking
for you.
Best regards,
Ralph Nader
P.S. Will you put this invitation on your website and see how your fans
react to Michael Moore returning to the Nader 2004 presidential
campaign? Patti Smith will reserve a big singing spot, for you, on the
stage for the customary finale, PEOPLE HAVE THE POWER.
Wednesday April 14, 2004
Join the Call for an Impeachment Inquiry of Bush and Cheney
Help us Get Congress to Take Action
You can help the call for an impeachment inquiry of President Bush and
Vice President Dick Cheney. Sign our online Petition.
http://www.votenader.org/get_involved/impeach.php
George W. Bush and Dick Cheney should be impeached for two reasons:
They led the United States into an illegal, unconstitutional war in Iraq.
They misled the Congress and the American people with five falsehoods that led to war.
All it takes is one Member of the House of Representatives to call for
an Impeachment Inquiry to start the process to investigate the two
grounds. If the House then votes by a simple majority for Articles of
Impeachment, the Senate would then undertake a trial of the President
and Vice President. They would only be convicted, and impeached, if
two-thirds of the Senate agrees.
--
the
Muslim Brotherhood International money laundering network of Dallah
Al-Baraka, Al-Taqwa, Al-Rahji Investment and Development Corp. Taqi Usmani
operates the Al-Balagh.net, which has a online bookstore in California
selling books written by individuals who are on the U.S. and UN terrorist
lists.
Jabara is a member of the legal advisory board for the Council for
Palestinian Restitution and Repatriation (CPRR) as well. The non-profit CPRR
exists to "provide legal assistance to Palestinian refugees and their heirs
and to educate the public about the legitimate rights of Palestinians."
Two members of the CPRR, Ishaq Farhan and Abdulateef Arabiyat, are members
of the Islamic Action Front (IAF)-an Islamist party affiliated with the
Muslim Brotherhood and Hamas.
Abdeen Jabara also works closely with another IFCO project called the
Coalition Against the "Counter Terror" Act. He distributes its flyers and
has appeared in a video for the group, which may be purchased for $15 a
copy - from IFCO.
Apparently someone is buying. According to a New York Post report, "the most
recent IRS records available for IFCO, from the year 2000, show that the
foundation took in $1,119,564 in contributions. A Not In Our Name statement
report that they have taken in more than $400,000 in recent months for the
purpose of pub
------------------------------
Date: Mon, 19 Apr 2004 19:33:06 GMT
From: Dale <dale@webeye.freeserve.co.uk>
Subject: Call for an Impeachment Inquiry of Bush and Cheney
Message-Id: <f1d16954.c6699164@host-69-48-73-244.roc.choiceone.net>
Call for an Impeachment Inquiry of Bush and Cheney,
Get Congress to Take Action
Sign our online Petition and read below for more information:
http://www.votenader.org/get_involved/impeach.php
HEY DUDE WHERE'S MY BUDDY!!!???
COME BACK HOME MICHAEL!!!
Ok Michael, you've had your realpolitik fling with ex-General Wesley
Clark. Your endorsed Presidential candidate in the Democratic Primaries
has withdrawn. It is time for you to come home, to join your buddies and
resume your only genuine role which is that of defiance and resistance.
Compliance and assistance with the Democrats does not accord with your
past, your character, your bold writings and, most memorably, your long
corrosive assaults on the Party that betrayed the working classes and
plunged our country into corporate globalization. Remember, Michael,
you're the flinty man from Flint, Michigan. You've never forgotten your
roots. The heady Hollywood, Manhattan scene with the celebrities and
Academy Awards have never gotten to your head but rather have gotten
into your deserving pockets. How we all recall your standing before one
billion people in Los Angeles at the televised Academy Awards in 2003
and, breaking the customary cant of the awardees, throwing the gauntlet
down to George W. Bush and his "fictitious" war mongering.
Now the War has become a quagmire, with both Republicans and Democrats
complicit (check the votes in Congress). The Draft may be on the way. So
what are you doing going on the Al Franken Show very nearly breaking
down when Al Gore (he of the pro NAFTA/GATT, anti-worker, regime-change,
Iraq-bombing, lethal sanctions on half a million children
Administration) called and thought you were apologizing. You have
nothing to apologize for, Michael. Gore has a lot to apologize
for-blowing the election he won in Florida and the country as a whole
and for blowing, with Bill Clinton, the many opportunities the
rich-booming Nineties and the collapse of the Soviet Union gave this
country to turn a peace dividend into a pro-worker, pro-environment,
pro-consumer and anti-poverty resurgence.
Come back and join our Presidential campaign, Michael. Talk to those
"Reagan Democrats"-those 35% of union members who still vote Republican
and against their own interests-as only you can. Michael, if you go
pumping for the Democratic Party this year, just what are you going to
say to the unemployed steelworkers near Sparrows Point in Maryland? To
the megathousands of laid off textile and furniture workers in North and
South Carolina? To the abandoned auto workers waiting and waiting near
their empty factories that went to repressive countries? To the millions
of blue-collar workers, who fought our wars, only to learn that the two
parties won't fight for their company pensions and health insurance? Are
you going to tell them how the Democratic Party pushed through the WTO,
let their pensions erode or disappear, were too busy collecting checks
from the corporate bosses to pay attention to the corporate crime wave
that looted and drained trillions of dollars from millions of workers,
their retirement and small investments? Will you tell them that the
cowardly Democrats, who couldn't win the fewer elections they are now
not losing without the labor vote, won't even mount a determined drive
to repeal the notorious, union-blocking Taft Hartley Act?
How can you be free to be what you are, or to depress Bush's vote, to
jolt into consciousness the moribund Democratic Party?
Hey Dude, join your real buddies! The ones you may be thinking about
just don't fit either your message, your vision, or our website
VoteNader.org.
Come back home Michael. The workers and the youth of America are looking
for you.
Best regards,
Ralph Nader
P.S. Will you put this invitation on your website and see how your fans
react to Michael Moore returning to the Nader 2004 presidential
campaign? Patti Smith will reserve a big singing spot, for you, on the
stage for the customary finale, PEOPLE HAVE THE POWER.
Wednesday April 14, 2004
Join the Call for an Impeachment Inquiry of Bush and Cheney
Help us Get Congress to Take Action
You can help the call for an impeachment inquiry of President Bush and
Vice President Dick Cheney. Sign our online Petition.
http://www.votenader.org/get_involved/impeach.php
George W. Bush and Dick Cheney should be impeached for two reasons:
They led the United States into an illegal, unconstitutional war in Iraq.
They misled the Congress and the American people with five falsehoods that led to war.
All it takes is one Member of the House of Representatives to call for
an Impeachment Inquiry to start the process to investigate the two
grounds. If the House then votes by a simple majority for Articles of
Impeachment, the Senate would then undertake a trial of the President
and Vice President. They would only be convicted, and impeached, if
two-thirds of the Senate agrees.
--
NION
has cemented alliances with bona fide radical organizations like the
Interreligious Foundation for Community Organization, Women's International
League for Peace and Freedom and the Revolutionary Communist Party.
Not In Our Name: What is IFCO?
Not In Our Name (NION) requests donations on its website, yet on this site
donors are asked to make checks payable to NION/IFCO. IFCO is the acronym
for the Interreligious Foundation for Community Organization. NION states
that the " Interreligous Foundation for Community Organization (IFCO). is
our fiscal sponsor." Fiscal sponsorship by IFCO means Not In Our Name
receives donations that are tax deductible because of IFCO's 501c(3)
(charitable, federal tax-exempt) status. IFCO charges a fee for this
service.
Why is NION not a 501c(3)?
Donations to NION/IFCO are then mailed to the Women's International League
for Peace and Freedom (WILPF), which is located at 339 Lafayette Street in
New York City. The address is the same as NION's. The intimate nature of a
financial partnership shows how closely aligned these two organizations are.
And that's scary, because the Women's International League for Peace and
Freedom has been associated with Communist causes since its inception. Molly
Klopot of the WILPF is a NION organizer. The WILPF is related to IFCO as
well as NION. Marilyn Clement, who is the Executive Director of WIPLF, is
the Treasurer of IFCO.
The building where the offices of NION, the WILPF and the War Resisters
League are located is known as the "Peace Pentagon," and is owned by the
A.J. Muste Memorial Institute. A.J. Muste was a "peace" advocate who
compiled frequent flier miles visiting Hanoi during the Vietnam War era. The
Muste Foundation funds groups like the War Resisters League, School of the
Americas Watch, Nicaragua Solidarity Network, International Peace bureau,
International Fellowship of Reconciliation, Coalition for Human Rights of
Immigrants, an
------------------------------
Date: 19 Apr 2004 11:12:11 -0700
From: kenvin007@yahoo.com (christie)
Subject: Re: foreach loop test
Message-Id: <f977ee23.0404191012.3e79ca8a@posting.google.com>
Brad Baxter <bmb@ginger.libs.uga.edu> wrote in message news:<Pine.A41.4.58.0404170900040.16046@ginger.libs.uga.edu>...
> On Fri, 16 Apr 2004, christie wrote:
> > Try this,
> >
> > $count = @test;
> >
> > for($i=0; $i<$count;$i++){
> > $tmp = $test[$i];
> > if($i == 0){print "First array: $tmp\n";}
> > if($i == floor($count/2)){print "Middle array: $tmp\n";}
> > if($i== $count){print "Last array: $tmp\n";}
> > }
>
> Did you try it? It will never print "Last array ..."
Of course, it will never print the last array 'cause $i<$count. It
should be $i<=$count. An entry level scripter should be able to fix
this bug.
>
> use warnings;
> use strict;
> use POSIX;
>
> my @test = ( 1, 2, 3, 4 );
> my $count = $#test;
>
> for my $i ( 0 .. $count ) {
> my $tmp = $test[$i];
> if ($i == 0) {
> print "First array: $tmp\n"; }
> if ($i == floor($count/2)) {
> print "Middle array: $tmp\n"; }
> if ($i == $count) {
> print "Last array: $tmp\n"; }
> }
>
> __END__
> First array: 1
> Middle array: 2
> Last array: 4
>
> Though the definition of "Middle" is muddled. :-)
>
> Regards,
>
> Brad
------------------------------
Date: Mon, 19 Apr 2004 13:14:12 -0500
From: "John" <john@newchester.com>
Subject: Re: LWP::Simple and utf8 problem
Message-Id: <c614tn$kcf$1@news.f.de.plusline.net>
If you are using Perl 5.8, use the Encode package. Although I don't know
exactly what you are getting from LWP, you probably need to use
_utf8_on($string) to tell Perl to treat the sequence of bytes as
UTF8-encoded characters.
If you are using Perl 5.6, you need to use pack and unpack. Here is a
subroutine that will do the same thing as "_utf8_on" in perl 5.6
sub unicode_semantics_56 {
my($string) = @_;
my $bad;
local $SIG{'__WARN__'} = sub {confess "Bad unicode string ($string):
".shift;};
my @charnumbers = unpack("U*", $string);
my $res = pack("U*", @charnumbers);
die if $bad;
return $res;
}
"Thomas Götz" <t.goetz@dkfz.de> wrote in message
news:R5Mgc.2539219$iA2.293729@news.easynews.com...
> Hi,
>
> I want to retrieve a webpage that includes unicode characters using the
> LWP::Simple module. But how can I tell LWP::Simple which coding it should
> use as I haven't found anything concerning coding in the docs.
>
> I use the following:
>
> ---
> #!/usr/bin/perl -w
>
> use strict;
> use warnings;
> use LWP::Simple;
>
> my $file = "tmpfile";
> my $url;
>
> $url = "http://www.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?";
> $url .= "db=Pubmed&retmax=500&id=15017969&retmode=xml";
>
> getstore($url, $file);
> exit;
> -----
>
> As it seems, the unicode characters are not correctly stored in the file.
As
> I'm not very familiar with utf8 stuff, I'd like to ask for a hint on how
to
> correctly store utf8-encoded webpages in a local file...!?
>
> Tom
>
------------------------------
Date: Mon, 19 Apr 2004 19:00:58 GMT
From: "edgrsprj" <edgrsprj@ix.netcom.com>
Subject: Re: One question
Message-Id: <KlVgc.13619$l75.7511@newsread2.news.atl.earthlink.net>
"Michele Dondi" <bik.mido@tiscalinet.it> wrote in message
news:v07580plmoh1jltl9qs4bnrg8oesr8gv6l@4ax.com...
> >is generating numbers that look reasonably accurate in a reasonable
amount
> >of time. The programs that I was using took as much as 2 hours to do a
> >single run. This Perl program does much more in perhaps 20 seconds. And
it
> >is so easy to modify and expand.
>
> Fine to know, so what?!?
>
For it to produce the most helpful results the program I have developed has
to be run multiple times and the results from each run compared. That is
much easier to do with a program which runs in just 20 seconds versus 2
hours. Also I was generally commenting on the fact that I was finding Perl
to be useful.
------------------------------
Date: Mon, 19 Apr 2004 12:56:52 -0700
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: pass in array or list of files
Message-Id: <190420041256521472%jgibson@mail.arc.nasa.gov>
In article <f6d34657.0404190820.5658c65a@posting.google.com>, joe
shaboo <jshaboo@hotmail.com> wrote:
> Hi again,
>
> I'm still working on a dns script. Last time I received some help and
> everything works as it should. Basically, it takes the named.conf file
> and comments out the next 5 lines of a domain that is given. THis
> works great if the domain is hardcoded into the script.
>
> What I'm trying to do is run through a file, and comment out names in
> my named.conf file that are no longer hosted.
>
> The script basically has
>
> @ARGV = ("named.conf")
>
> while (<>) {
> if (/\b<a new domain feed from a list>/) {
> $commenting = 1;
> }
> print "//" if $commenting;
> print;
> $commenting = 0 if /^\s*}/;
> }
> exit;
>
> How can I pass in a new variable from file1, in some kind of for loop?
Read the file into an array. Asssuming that the names are one per line:
open(IN,$file1) or die("Can't open $file1: $!");
@domains = <IN>;
close IN;
chomp(@domains);
>
> So, it will individually go through file1, which contains, test.com,
> test.net, test.org, test.ws, and comment them out of my named.conf.
Change your if condition to one that uses grep to see if there is a
match in the line in named.conf to any element in the @domains array:
if( grep( $line=~/^\s*zone\s+"\Q$_\E"/, @domains) ) {
$commenting = 1;
}
Note that I have added more details of the line to match and surrounded
the domain name with \Q and \E to escape (take literally without
interpretation) the '.' characters in the domain name. Otherwise, a '.'
will match any character in the input line.
>
> Also, alternatively, it would be nice to pass the name of the domain
> at the command line. Simple, right...
Use a command line option like "-f file" to read domain names from
file, and add any additional command-line arguments as domain names.
Using the module Getopt::Long makes this easy:
use Getopt::Long;
my $file1;
GetOptions("f=s"=>\$file1);
my @domains;
if( $file1 ) {
open(IN,$file1) or die("Can't open $file1: $!");
@domains = <IN>;
close IN;
chomp(@domains);
}
push(@domains,@ARGV);
And add the following at the beginning:
use strict;
use warnings;
------------------------------
Date: Mon, 19 Apr 2004 14:15:25 -0400
From: Paul Lalli <ittyspam@yahoo.com>
Subject: Re: Perl is the answer?
Message-Id: <20040419140511.O21613@dishwasher.cs.rpi.edu>
On Mon, 19 Apr 2004, Andries wrote:
> Hello there,
>
> I hope someone can help me.
> This is my problem:
> I have a list of thousands and thousands of the next lines:
> ----------------------------------------------------------------------
> <a href="hs80.htm#halveringstijd"target="topic">halveringstijd</a><br>
> <a href="hs80.htm#hartkleppen" target="topic"></a><br>
> <a href="hs80.htm#hartvolume" target="topic"></a><br>
> <a href="hs80.htm#hemoglobine" target="topic"></a><br>
> <a href="hs80.htm#heteroseksueel " target="topic"></a><br>
> <a href="hs80.htm#hijgen" target="topic"></a><br>
> <a href="hs80.htm#histamine" target="topic"></a><br>
> --------------------------------------------------------------------------------------
> I need to copy the word between the # and " and put it after the > and
> </a>
>
> It can done by hand like the first line but it can be automated with a
> perl script isn't it?
>
> If so I still have a problem can anyone tell me how?
Are these the only lines in the file, or is this an actual HTML file? If
these are the only lines in the entire file, this is (relatively) simple:
perl -pi.bkp -e 's/#(.*?)"([^>]+?)>/#$1"$2>$1/' file.html
The i.bkp piece of that will make a backup copy of your file, just in case
it didn't do exactly what you wanted.
If you have an actual HTML file, I would suggest visiting CPAN and looking
at the various HTML Parsing modules. http://search.cpan.org
Paul Lalli
------------------------------
Date: 19 Apr 2004 18:21:16 GMT
From: Glenn Jackman <xx087@freenet.carleton.ca>
Subject: Re: Perl is the answer?
Message-Id: <slrnc8864t.ptf.xx087@smeagol.ncf.ca>
Andries <andries@zilz.nl> wrote:
> Hello there,
>
> I hope someone can help me.
> This is my problem:
> I have a list of thousands and thousands of the next lines:
> ----------------------------------------------------------------------
> <a href="hs80.htm#halveringstijd"target="topic">halveringstijd</a><br>
> <a href="hs80.htm#hartkleppen" target="topic"></a><br>
> <a href="hs80.htm#hartvolume" target="topic"></a><br>
> <a href="hs80.htm#hemoglobine" target="topic"></a><br>
> <a href="hs80.htm#heteroseksueel " target="topic"></a><br>
> <a href="hs80.htm#hijgen" target="topic"></a><br>
> <a href="hs80.htm#histamine" target="topic"></a><br>
> --------------------------------------------------------------------------------------
> I need to copy the word between the # and " and put it after the > and
> </a>
perl -pi -we 's{#(.*?)(".*>)(</a>)}{#$1$2$1$3}' file.html ...
--
Glenn Jackman
NCF Sysadmin
glennj@ncf.ca
------------------------------
Date: 19 Apr 2004 12:36:40 -0600
From: Jim Cochrane <jtc@shell.dimensional.com>
Subject: Re: Perl is the answer?
Message-Id: <slrnc8871o.ufs.jtc@shell.dimensional.com>
In article <4d3880lph91adlhpds8sv0ndo4btcdb13s@4ax.com>, Andries wrote:
> Hello there,
>
> I hope someone can help me.
> This is my problem:
> I have a list of thousands and thousands of the next lines:
> ----------------------------------------------------------------------
><a href="hs80.htm#halveringstijd"target="topic">halveringstijd</a><br>
><a href="hs80.htm#hartkleppen" target="topic"></a><br>
><a href="hs80.htm#hartvolume" target="topic"></a><br>
><a href="hs80.htm#hemoglobine" target="topic"></a><br>
><a href="hs80.htm#heteroseksueel " target="topic"></a><br>
><a href="hs80.htm#hijgen" target="topic"></a><br>
><a href="hs80.htm#histamine" target="topic"></a><br>
> --------------------------------------------------------------------------------------
> I need to copy the word between the # and " and put it after the > and
></a>
>
> It can done by hand like the first line but it can be automated with a
> perl script isn't it?
>
> If so I still have a problem can anyone tell me how?
>
>
> TIA
> Andries Meijer
Here's one way to do it:
#!/usr/bin/perl -n
use strict;
use warnings;
my ($part1, $part2, $part3, $part4) = /([^#]*#)([^"]*)("[^>]*><\/a>)(.*)/;
if ($part4) {
print "${part1}${part2}${part3}${part2}${part4}\n";
} else {
print
}
--
Jim Cochrane; jtc@dimensional.com
[When responding by email, include the term non-spam in the subject line to
get through my spam filter.]
------------------------------
Date: Mon, 19 Apr 2004 19:29:09 BST
From: gml4410@ggr.co.uk (Lack Mr G M)
Subject: Re: Perl is the answer?
Message-Id: <2004Apr19.192909@ukwit01>
In article <4d3880lph91adlhpds8sv0ndo4btcdb13s@4ax.com>, Andries <andries@zilz.nl> writes:
|>
|> I hope someone can help me.
|> This is my problem:
|> I have a list of thousands and thousands of the next lines:
|> ----------------------------------------------------------------------
|>...
|> <a href="hs80.htm#hartkleppen" target="topic"></a><br>
|> --------------------------------------------------------------------------------------
|> I need to copy the word between the # and " and put it after the > and
|> </a>
|>
|> It can done by hand like the first line but it can be automated with a
|> perl script isn't it?
An emacs keyboard macro is a possibility too.
|> If so I still have a problem can anyone tell me how?
Well, on the first line you showed (the one you had edited) you'd lost
a space before target=.
--
--------- Gordon Lack --------------- gml4410@ggr.co.uk ------------
This message *may* reflect my personal opinion. It is *not* intended
to reflect those of my employer, or anyone else.
------------------------------
Date: Mon, 19 Apr 2004 20:24:13 +0100
From: "Julia deSilva" <jds@nospantrumpetweb.co.uk>
Subject: Re: Perl is the answer?
Message-Id: <gEVgc.1614$5B6.782@news-binary.blueyonder.co.uk>
> I hope someone can help me.
> This is my problem:
> I have a list of thousands and thousands of the next lines:
> I need to copy the word between the # and " and put it after the > and
> </a>
>
> It can done by hand like the first line but it can be automated with a
> perl script isn't it?
>
Can be done very simply in any programming language, but if you are only
using it once or twice I'd just use a macro in a good text viewer. I like
www.textpad.com but Word could be used.
------------------------------
Date: Mon, 19 Apr 2004 19:31:26 GMT
From: "edgrsprj" <edgrsprj@ix.netcom.com>
Subject: Request for program test on different operating sytsems
Message-Id: <iOVgc.13634$l75.5902@newsread2.news.atl.earthlink.net>
# April 19, 2004 - This is the first line of Perltest.txt - A comment
# This is the second line of the print test - Also a comment
#
# This is a Perl test program which is intended to see what has to be
# done to get this program to run on computers with different operating
# systems.
#
# I am trying to learn how to have it correctly read text from a text file
# and then have different operating systems automatically open that
# same file with a text editor. That information will then be used to
# prepare the next version of a scientific program I am circulating
# to researchers around the world.
#
# A copy of this test program has been temporarily stored at:
#
# http://www.freewebz.com/eq-forecasting/Perltest.zip
#
# It is requested that people download that file, unzip it, and
# try running the file inside it instead of using this present file.
# That would show if the text file displayed properly on different
# computers.
#
# Then please state if it ran Ok in a note posted to this Newsgroup.
#
# However, tests involving doing the same with this copy of the file
# would also provide helpful information.
#
# To use that downloaded zip file:
# Choose or create a directory to run this program.
# Download that zip file, unzip the two files in it.
# Store them in the directory you selected.
# Open the Perltest.pl file with a text editor.
# Substitute the name of the directory you want to use in the following
# line.
$directoryname = 'C:\ETDPROG';
$directoryname = $directoryname.chr(92);
# the above line adds a \ to the directory name
# Store the file again in that directory.
#
# Or,
#
# To use this present file:
# Change that directory name (several lines up) in this copy of the program.
# Store this entire file as Perltest.txt in that directory.
# Store this entire file as Perltest.pl in that directory.
#
# Tell the Perltest.pl program to run.
#
# It should print the following 2 lines on your computer screen.
# April 19, 2004 - This is the first line of Perltest.txt - A comment
# This is the second line of the print test - Also a comment
# Then it will pause for 25 seconds.
# Then it will try to get a text editor to open and display Perltest.txt.
#
# Did it print those lines Ok?
# If it did not, then what commands need to be added to it to get it to run?
#
# It should create a Perltest.bat file which the program then tells to run.
# With Windows XP that program will cause a text editor to open the
# Perltest.txt file and display it.
#
# Did it do that for people running Windows XP?
#
# If the command lines for storing information in the Perltest.bat file
# are changed to the one for Windows 98 then that program should cause a
# text editor to open and display the Perltest.txt file.
#
# Did it do that for people using Windows 98?
#
# What option commands need to be added to the program so that uses can
# get it to run on other operating systems?
#
# What option commands need to be added to it so that they can get it
# to automatically open and display the Perltest.txt file?
#
# Please post any information and comments to the:
# comp.lang.perl.misc Newsgroup Thanks.
#
open testfile, '< '.$directoryname.'Perltest.txt';
@testarray = <testfile>;
close testfile;
print substr($testarray[0], 0, length($testarray[0]) -3), "\n";
print substr($testarray[1], 0, length($testarray[1]) -3), "\n";
print "\n";
print "\n";
print 'This program should have read the Perltest.txt file and', "\n";
print 'then at the top, printed the following lines (preceded by number
signs)', "\n";
print 'There should not be any blank lines between those two lines', "\n";
print "\n";
print 'April 19, 2004 - This is the first line of Perltest.txt - A
comment', "\n";
print 'This is the second line of the print test - Also a comment', "\n";
print "\n";
print 'This program should now halt for 25 seconds.', "\n";
print 'Then it will try to have a text editor open and display', "\n";
print 'the file named Perltest.txt', "\n";
print "\n";
for $delaytime(1..25){;
print 26 - $delaytime, "\n";
sleep 1};
# For use with Windows XP
#
# If you are using Windows 98 or some other operating system:
# Add # at the start of the first print line below.
# Then if you are using Windows 98 remove the # at the start of
# the second print line below.
# If are not using either version of Windows then add # at the
# start of the exec line below.
open batfile, '> '.$directoryname.'Perltest.bat';
print batfile 'c:\windows\start.exe '.$directoryname.'Perltest.txt';
# print batfile 'c:\windows\start.exe '.$directoryname.'Perltest.txt';
close batfile;
# What optional commands need to added here to get other operating systems
# to have a text editor automatically open Perltest.txt file
# and display it?
# The following statement will tell Windows XP or 98 to run that bat file
# Add a # at the start of this line if you are using some other
# operating system.
exec $directoryname.'Perltest.bat';
__END__
The last line before that __END__ is the end of this program.
any text can be entered below the __END__ statement without the need
for the number signs which are at the beginning of comment lines etc.
------------------------------
Date: Mon, 19 Apr 2004 19:38:45 GMT
From: "edgrsprj" <edgrsprj@ix.netcom.com>
Subject: Re: Request for program test on different operating sytsems
Message-Id: <9VVgc.13640$l75.1892@newsread2.news.atl.earthlink.net>
"edgrsprj" <edgrsprj@ix.netcom.com> wrote in message
news:iOVgc.13634$l75.5902@newsread2.news.atl.earthlink.net...
There are several lines which in that program which
got "wrapped" somehow. As a result the program
might not run properly. I thought that I caught them
all before sending the file.
> print 'then at the top, printed the following lines (preceded by number
> signs)', "\n";
> print 'April 19, 2004 - This is the first line of Perltest.txt - A
> comment', "\n";
If you want to try running the test just go through the code and "unwrap"
those lines.
Thanks.
------------------------------
Date: Mon, 19 Apr 2004 18:28:12 +0000 (UTC)
From: J Krugman <jkrugman@yahbitoo.com>
Subject: Selective deletion from symbol table?
Message-Id: <c615ns$kqp$1@reader2.panix.com>
Suppose I have this:
*foo = sub { print "hello from foo\n" };
*foo = \3;
Now &foo and $foo are defined in the current package (let's say
it's main). Now suppose that I want to undefine &foo. Something
like
delete $main::{foo}
would undefine not only &foo but $foo as well. Is there a way to
undefine *only* &foo?
Thanks!
jill
P.S. The motivation for this question is the sub mk_classdata, the
sole method in the CPAN module Class::Data::Inheritable:
sub mk_classdata {
my ($declaredclass, $attribute, $data) = @_;
my $accessor = sub {
my $wantclass = ref($_[0]) || $_[0];
return $wantclass->mk_classdata($attribute)->(@_)
if @_>1 && $wantclass ne $declaredclass;
$data = $_[1] if @_>1;
return $data;
};
my $alias = "_${attribute}_accessor";
*{$declaredclass.'::'.$attribute} = $accessor;
*{$declaredclass.'::'.$alias} = $accessor;
}
This is nice, but IMHO one *minor* flaw is that once one makes a
derived class "opaque" with respect to a given class attribute
(which happens if one sets the class attribute for the derived
class $wantclass) there is no way to undo this. It would be nice
if, for example, setting the class attribute for the derived class
to undef had the effect of making the derived class once again
"transparent" with respect to the class attribute. Or course, this
is not perfect either, since there may be cases in which undef is
a perfectly acceptable value for the class attribute to have, and
in these cases we wouldn't want this behavior, but, in any case,
it got me thinking about the general problem of selectively undoing
an assignment such as
*{$declaredclass.'::'.$attribute} = $accessor;
--
To s&e^n]d me m~a}i]l r%e*m?o\v[e bit from my a|d)d:r{e:s]s.
------------------------------
Date: Mon, 19 Apr 2004 12:10:48 -0700
From: Steven Kuo <skuo@mtwhitney.nsc.com>
Subject: Re: Selective deletion from symbol table?
Message-Id: <Pine.GSO.4.21.0404191208320.353-100000@mtwhitney.nsc.com>
On Mon, 19 Apr 2004, J Krugman wrote:
>
> Suppose I have this:
>
> *foo = sub { print "hello from foo\n" };
> *foo = \3;
>
> Now &foo and $foo are defined in the current package (let's say
> it's main). Now suppose that I want to undefine &foo. Something
> like
>
> delete $main::{foo}
>
> would undefine not only &foo but $foo as well. Is there a way to
> undefine *only* &foo?
> ...
Use 'undef' as described in 'perldoc perlsub':
use strict;
use warnings;
use vars qw(*foo);
*foo = sub { print "hello from foo\n" };
*foo = \3;
foo();
print $foo, "\n";
undef(&{*foo{CODE}}); # see 'perldoc perlref' regarding this syntax
# or more simply:
# undef(&foo);
eval {
foo();
};
print "Uable to run foo subroutine : $@";
print $foo, "\n";
--
Hope this helps,
Steven
------------------------------
Date: Mon, 19 Apr 2004 19:54:20 +0000 (UTC)
From: J Krugman <jkrugman@yahbitoo.com>
Subject: Re: Selective deletion from symbol table?
Message-Id: <c61apc$mn1$1@reader2.panix.com>
In <Pine.GSO.4.21.0404191208320.353-100000@mtwhitney.nsc.com> Steven Kuo <skuo@mtwhitney.nsc.com> writes:
< snip >
>Hope this helps,
Yes, very much. Thanks!
jill
--
To s&e^n]d me m~a}i]l r%e*m?o\v[e bit from my a|d)d:r{e:s]s.
------------------------------
Date: Mon, 19 Apr 2004 18:53:44 GMT
From: Steve Linberg <slinberg@crocker.com>
Subject: stupid regexp question
Message-Id: <slinberg-84150E.14534319042004@netnews.comcast.net>
For whatever reason, I'm suffering a massive brain cramp today and I
just can't figure this simple thing out, and I'm already embarrassed
about it so please don't rub it in too hard. :) Digging through man
pages, google, and the Camel isn't putting an answer in front of me that
my addled head can grok. If anybody can supply a hefty dope-slap for
what I'm sure is a simple task, I'd be most appreciative.
I just need a regexp that says "match any complete string not equal to
'mysql' or 'test'."
I can't use "!~ /^(mysql|test)$/" because this is an argument to feed to
a script that uses a positive search and puts the regexp in
$opt{regexp}, for use as in "=~ /$opt{regexp}/". Yes, I can hack the
script, but I'd rather not if I can avoid it.
The specific task is for mysqlhotcopy, where you can provide a regexp
for databases to dump. I want to tell it to dump everything EXCEPT
"mysql" and "test", so I need a single positive regexp that matches
everything except those two strings. For the life of me, I just can't
get my brain to spit it out.
(holding still for dope-slap)
TIA.
------------------------------
Date: Mon, 19 Apr 2004 12:39:41 -0700
From: Steven Kuo <skuo@mtwhitney.nsc.com>
Subject: Re: stupid regexp question
Message-Id: <Pine.GSO.4.21.0404191232310.353-100000@mtwhitney.nsc.com>
On Mon, 19 Apr 2004, Steve Linberg wrote:
(snipped) ...
> I just need a regexp that says "match any complete string not equal to
> 'mysql' or 'test'."
>
> I can't use "!~ /^(mysql|test)$/" because this is an argument to feed to
> a script that uses a positive search and puts the regexp in
> $opt{regexp}, for use as in "=~ /$opt{regexp}/". Yes, I can hack the
> script, but I'd rather not if I can avoid it.
>
> The specific task is for mysqlhotcopy, where you can provide a regexp
> for databases to dump. I want to tell it to dump everything EXCEPT
> "mysql" and "test", so I need a single positive regexp that matches
> everything except those two strings. For the life of me, I just can't
> get my brain to spit it out.
Negative look-ahead? This will allow you to use the '=~' operator.
For example,
print if ( $_ =~ /^(?!mysql$|test$)/ );
# or less verbose:
print if /^(?!mysql$|test$)/;
--
Hope this helps,
Steven
------------------------------
Date: 19 Apr 2004 12:21:48 -0700
From: pr.software@nomade.fr (PRSoftware)
Subject: Re: Win32::Console with perl2exe -gui
Message-Id: <90cbb77.0404191121.75d90938@posting.google.com>
Effectively, if you "compile" your code with the command
perl2exe t.pl
it works but if you compile with the command
perl2exe -gui t.pl
the command window is opened but nothing is written in (at least on my
PC) and the input doesn't function anymore.
Did you try your code with the "-gui" option ?
Thanks for your help
PR
------------------------------
Date: Mon, 19 Apr 2004 15:38:02 -0400
From: Paul Lalli <ittyspam@yahoo.com>
Subject: Re: Win32::Console with perl2exe -gui
Message-Id: <20040419153625.L21613@dishwasher.cs.rpi.edu>
On Mon, 19 Apr 2004, PRSoftware wrote:
> Effectively, if you "compile" your code with the command
>
> perl2exe t.pl
>
> it works but if you compile with the command
>
> perl2exe -gui t.pl
>
> the command window is opened but nothing is written in (at least on my
> PC) and the input doesn't function anymore.
>
> Did you try your code with the "-gui" option ?
... which is exactly what's supposed to happen. The whole point of the
-gui option is to disable the console window from appearing, so the
program will just run with a GUI. (of course, in your code, you
override this by explicitly calling a Win32::Console). If you don't want
that behavior, why are you adding the -gui option?
Paul Lalli
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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 V10 Issue 6426
***************************************