[19510] in Perl-Users-Digest
Perl-Users Digest, Issue: 1705 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Sep 6 14:10:35 2001
Date: Thu, 6 Sep 2001 11:10:15 -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: <999799814-v10-i1705@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 6 Sep 2001 Volume: 10 Number: 1705
Today's topics:
Is PERL supported <vprasad@americasm01.nt.com>
Re: Is PERL supported (Randal L. Schwartz)
Re: Is PERL supported (Tad McClellan)
Re: Is PERL supported <jurgenex@hotmail.com>
Making a script a Windows 2000 service <bberube@versus.com>
Re: Making a script a Windows 2000 service <for_mike@yahoo.com>
MIME::Word charset for input ?? <geert@audenaert.com>
need a loop command <Mark.Pennington@sdrc.com>
Re: Net::Telnet module (Chas Friedman)
Pattern matching in loop <Laocoon@eudoramail.com>
Re: perl "study" function in java? (crypto_boy)
Re: PERL modules and GPL license (Randal L. Schwartz)
Re: PERL modules and GPL license <ilya@martynov.org>
Re: PERL modules and GPL license (Mark Jason Dominus)
Re: PERL modules and GPL license (Mark Jason Dominus)
Permissions - Is nobody better? (BUCK NAKED1)
Regular Expression puzzle... <fredcoyoteno@spamgo.com>
Re: Regular Expression puzzle... (John J. Trammell)
Re: Regular Expression puzzle... <Laocoon@eudoramail.com>
Re: Regular Expression puzzle... (Tad McClellan)
Re: Undef'ing multiple variables <h.m.brand@hccnet.nl>
Re: Undef'ing multiple variables (Jonas Nilsson)
Re: Undef'ing multiple variables <Tassilo.Parseval@post.rwth-aachen.de>
Re: Undef'ing multiple variables <tinamue@zedat.fu-berlin.de>
Re: Undef'ing multiple variables <tinamue@zedat.fu-berlin.de>
Re: Undef'ing multiple variables <Tassilo.Parseval@post.rwth-aachen.de>
Win32:API module installation on a stand alone machine <nials@britain.agilent.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 6 Sep 2001 09:36:45 -0400
From: "Prasad, Victor [FITZ:K500:EXCH]" <vprasad@americasm01.nt.com>
Subject: Is PERL supported
Message-Id: <9n7u5c$n8d$1@bcarh8ab.ca.nortel.com>
Just out of curiosity - is Perl supported - or is it considered free like
Linux.
At work - everybody agrees with Perl but the complaint is it is not
supported. What ever that means. I think most businesses use it.
V
------------------------------
Date: 06 Sep 2001 07:04:09 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Is PERL supported
Message-Id: <m13d602z6u.fsf@halfdome.holdit.com>
>>>>> "Prasad," == Prasad, Victor [FITZ:K500:EXCH] <Prasad> writes:
Prasad,> Just out of curiosity - is Perl supported - or is it considered free like
Prasad,> Linux.
Yes and yes.
Prasad,> At work - everybody agrees with Perl but the complaint is it is not
Prasad,> supported. What ever that means. I think most businesses use it.
It's supported like anything else is supported. You buy a license for
it (for $0, in Perl's case), and you install it. If you want someone
to answer your questions on demand, you pay money to someone (and
there are companies who do that for Perl). Otherwise, you can join
user groups (like your local Perl Monger group) and discussion areas
(like this one) for free.
Anything else is just FUD-raising. Perl is a real product. Just
because the license costs $0 doesn't mean it's not a real product,
with real people behind it.
print "Just another Perl hacker,"
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Thu, 06 Sep 2001 15:06:31 GMT
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Is PERL supported
Message-Id: <slrn9pf1al.42d.tadmc@tadmc26.august.net>
Prasad, Victor [FITZ:K500:EXCH] <vprasad@americasm01.nt.com> wrote:
>Just out of curiosity - is Perl supported - or is it considered free
^^
^^
"free" and "supported" are NOT mutually exclusive.
Your Question is Asked Frequently:
perldoc -q support
"Who supports Perl? Who develops it? Why is it free?"
You are expected to check the Perl FAQs *before* posting to
the Perl newsgroup.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 6 Sep 2001 10:09:51 -0700
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Is PERL supported
Message-Id: <3b97ade0@news.microsoft.com>
"Prasad, Victor [FITZ:K500:EXCH]" <vprasad@americasm01.nt.com> wrote in
message news:9n7u5c$n8d$1@bcarh8ab.ca.nortel.com...
> Just out of curiosity - is Perl supported - or is it considered free like
> Linux.
I guess the answer is "yes" :-)
jue
------------------------------
Date: Thu, 6 Sep 2001 09:11:19 -0400
From: "Neb" <bberube@versus.com>
Subject: Making a script a Windows 2000 service
Message-Id: <XBKl7.22252$Z2.291503@nnrp1.uunet.ca>
Hi,
I have a script that I want to run every minute on my Windows 2000 Server.
What is the best way to do this? Is the scheduled tasks a good solution for
this? Or is there a better one?
Thanks for the help,
ben
------------------------------
Date: Thu, 6 Sep 2001 16:45:55 +0300
From: "Michael Reveko" <for_mike@yahoo.com>
Subject: Re: Making a script a Windows 2000 service
Message-Id: <9n7umg$q4j$1@news.lucky.net>
"Neb" <bberube@versus.com> wrote in message
news:XBKl7.22252$Z2.291503@nnrp1.uunet.ca...
> Hi,
>
> I have a script that I want to run every minute on my Windows 2000 Server.
> What is the best way to do this? Is the scheduled tasks a good solution
for
> this? Or is there a better one?
You can also write a script that runs as a service and activates every
minute (use sleep() to specify the pause).
You can read the details about this in
<PERL_DIR>/html/faq/Windows/ActivePerl-Winfaq4.html if you use the
ActiveState's Perl distribution.
Michael.
------------------------------
Date: Thu, 06 Sep 2001 16:34:00 GMT
From: "Big G" <geert@audenaert.com>
Subject: MIME::Word charset for input ??
Message-Id: <YzNl7.39037$6x5.8521244@afrodite.telenet-ops.be>
Hi,
i'm using the encode_mimewords function of the MIME::Words package to
encode the headers in my email.
$encoded_string = encode_mimewords($not_encoded_string);
I would like to know in which charset i have to place the
$not_encoded_string.
For the moment i'm using utf-8 but this results in inproper encoding.
TIA,
Geert
------------------------------
Date: Thu, 06 Sep 2001 13:09:09 -0400
From: Mark Pennington <Mark.Pennington@sdrc.com>
Subject: need a loop command
Message-Id: <3B97ADB4.4DC1752B@sdrc.com>
--------------DFF353C68DF4B5C5C539F0D8
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
I need to make a loop in perl for a problem that I am working on. The
loop needs to be go through 6 files that contains 13 programs each (one
of the 13 programs is listed below.) Eight files have 6 programs (what
is listed below.) One file has 82 programs in it. The PRG variable
below will change with each test. The MF variable will also change with
each individual test. One example is as follows:
PRG=number1.prg # initializes what PRG stands.
Will change with each different test.
MF=mf_number1.mf # initializes MF. This will also
change with each different test.
rm z* .*param *.mf* *.prg err* # removes the unnecessary files
cp /PATH/$MF* . # copies the necessary model
file needed to run the program
gunzip *.gz; # gunzip's any files
that need to be unzipped
cp /PATH/$PRG . # copies the necessary prg
files
[program] -q -m $MF -r $PRG # this line run the script with the
copied model file and prg file
rm z* .*param *.mf* *.prg err* # removes all the unnecessary files
mv *.dat ./results/ # moves the data results
to a directory.
Does anyone have any ideas on how to make a loop for this problem??
--
Mark Pennington | Office: (513) 576-3675
Product Development | Fax: (513) 576-2654
EDS PLM Solutions | http://www.sdrc.com
2000 Eastman Dr. Milford, OH 45150 | mark.pennington@sdrc.com
--------------DFF353C68DF4B5C5C539F0D8
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
I need to make a loop in perl for a problem that I am working
on. The loop needs to be go through 6 files that contains 13 programs
each (one of the 13 programs is listed below.) Eight files have 6
programs (what is listed below.) One file has 82 programs in it.
The PRG variable below will change with each test. The MF variable
will also change with each individual test. One example is as follows:
<P>PRG=number1.prg
# initializes what PRG stands. Will change with each different test.
<BR>MF=mf_number1.mf
# initializes MF. This will also change with each different test.
<BR>rm z* .*param *.mf* *.prg err* # removes the
unnecessary files
<BR>cp /PATH/$MF* .
# copies the necessary model file needed to run the program
<BR>gunzip *.gz;
# gunzip's any files that need to be unzipped
<BR>cp /PATH/$PRG .
# copies the necessary prg files
<BR>[program] -q -m $MF -r $PRG # this line run the script
with the copied model file and prg file
<BR>rm z* .*param *.mf* *.prg err* # removes all
the unnecessary files
<BR>mv *.dat ./results/
# moves the data results to a directory.
<BR>
<P>Does anyone have any ideas on how to make a loop for this problem??
<PRE>--
Mark Pennington | Office: (513) 576-3675
Product Development | Fax: (513) 576-2654
EDS PLM Solutions | <A HREF="http://www.sdrc.com">http://www.sdrc.com</A>
2000 Eastman Dr. Milford, OH 45150 | mark.pennington@sdrc.com</PRE>
</HTML>
--------------DFF353C68DF4B5C5C539F0D8--
------------------------------
Date: Thu, 06 Sep 2001 15:58:27 GMT
From: friedman@math.utexas.edu (Chas Friedman)
Subject: Re: Net::Telnet module
Message-Id: <3b979c77.2408420958@news.cc.utexas.edu>
On 6 Sep 2001 04:28:28 -0700, ianjy@hotmail.com (ian) wrote:
>I seem to be having a random problem with this module.....
>Using the basic example provided (telnet to a host,run 'who' and print
>the results)
>Some of the time it works fine - output is as expected - no probs.
>
>But there are a lot of times when there is no output at all.
>The logs show the prompts and the command being sent and more
>prompts...
>but no command echo and no results.
>
>Could this be a timing issue??
>
>I've tried various prompt matches - and simplified the remote systems
>prompt,
>the prompt is being recognised, but the command doesn't seem to be
>seen by the remote host.
>
>Thanks
I had problems like the ones you mention also. Here is a script which
seems successful:
#!/usr/bin/perl
# file: remote.pl
use strict;
use Net::Telnet;
my $passwd=shift;
my $telnet =
Net::Telnet->new(Host=>'linux63.ma.utexas.edu',Prompt=>'/linux63> $
/');
$telnet->waitfor('/login/');
$telnet->print("friedman");
$telnet->waitfor('/Password/');
$telnet->print("$passwd\n");
$telnet->waitfor('/linux63/');
my @lines = $telnet->cmd("date");
$telnet->print("logout\n");
print @lines;
~
(Of course, you'll have to change the prompt and user name.)
------------------------------
Date: Thu, 6 Sep 2001 16:26:48 +0200
From: Laocoon <Laocoon@eudoramail.com>
Subject: Pattern matching in loop
Message-Id: <Xns9114A8A7F9AC4Laocooneudoramail@62.153.159.134>
I am writing a small Chatbot to say hello to people that enter my room.
Its supposed to only say Hi to people that enter the first time. Its all
working with the first guy but then it stops working.I thought it might be
that $1 is not being changed each iteration but i think it should..
Here's a code snippet :
for(;;){
sleep(1);
$SendMessage->Call($readchat,0x00B1,0,$u); #select all chat
$clipb->Empty(); #empty clipboard
$SendMessage->Call($readchat,0x0301,0,0); #copy chat to clipboard
$thechat = $clipb->Get(); #obtain chat from blipboard
next if $thechat !~ /\(\w{5}\)>\s(\w+)/; #Match stuff of format
# "(Enter)> Some_Name" and
#stores Some_Name in $1.
next if $people{$1}; #next unless he is *new*
$msg = "Hi $1 and welcome to my Room!"; #compose a hello message
$people{$1} = 1; #Note he has entered
}
# --- Message is sent here ---
}
Btw i know that thats a rather complicated approach to getting the Chat
(copy to clipboard etc) but its a RichEdit 2 Control and it doesn't respond
to other stuff i tried.
Any Ideas or suggestions?
Greg
------------------------------
Date: 6 Sep 2001 08:53:48 -0700
From: crypto-boy@llnl.gov (crypto_boy)
Subject: Re: perl "study" function in java?
Message-Id: <646ea35e.0109060753.66384012@posting.google.com>
Carl Smotricz <elrac@gmx.net> wrote in message news:<3B8E5D95.60ADA3D@gmx.net>...
> Hello Crypto,
>
> IBM (among others) has built a good, powerful regular expression library
> for Java. They say
>
> [quote]
> Regex for Java is a powerful, high-performance, regular expression
> library for Java. With Regex for
> Java, a search can be done for a string matching a regular expression
> pattern in your application.
>
> Regex for Java supports almost all features of Perl5's regular
> expression; it also supports the
> syntax of XML Schema's regualar expression.
> [/quote]
>
> The address for this marvel of technology, which may be free but I don't
> quite understand the licensing terms, is:
>
> http://www.alphaworks.ibm.com/tech/regex4j
>
> You can build as many regexp objects with compiled expressions as you
> want, and run your string against the whole list. Sounds to me like what
> you're looking for.
>
> Enjoy!
>
> -Carl-
Thanks! I'll look into this today.
Crypto-boy
------------------------------
Date: 06 Sep 2001 06:32:11 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: PERL modules and GPL license
Message-Id: <m1k7zc30o4.fsf@halfdome.holdit.com>
>>>>> "Samppa" == Samppa <sami@xenetic.fi> writes:
Samppa> hello there,
Samppa> I am planning to use PERL modules which are publised under
Samppa> GPL license. I am not changing the code of these modules just
Samppa> using them.
Samppa> What is your opinion, how does these modules (under GPL)
Samppa> affect to my code licensing and the availability
Samppa> to my source code ?
Samppa> Can I distribute the code without source codes ?
Samppa> We are planning to distribute the code as binary
Samppa> version only, but without license payments.
Almost everything in the CPAN says "distributed under the same
licensing terms as Perl itself". If that's the case, it's under both
the GPL and the AL. The GPL would (likely) not permit you to do what
you ask, but the AL certainly would, as long as you don't call the
result "Perl".
This is one of the coolest things about the Perl CPAN... we can indeed
do nearly everything we want to do. :)
Ethically, it behooves you to give proper credit to all the
contributors to your project somewhere in your documentation. So
please do so.
print "Just another Perl hacker,"
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: 06 Sep 2001 17:53:08 +0400
From: Ilya Martynov <ilya@martynov.org>
Subject: Re: PERL modules and GPL license
Message-Id: <87heugqvcr.fsf@abra.ru>
>>>>> On 6 Sep 2001 02:49:32 -0700, sami@xenetic.fi (Samppa) said:
S> hello there,
S> I am planning to use PERL modules which are publised under
S> GPL license. I am not changing the code of these modules just
S> using them.
S> What is your opinion, how does these modules (under GPL)
S> affect to my code licensing and the availability
S> to my source code ?
S> Can I distribute the code without source codes ?
S> We are planning to distribute the code as binary
S> version only, but without license payments.
If I understand GPL correctly than if you are using Perl modules
having GPL licence you have to use GPL for your own code too.
Check GPL FAQ:
http://www.fsf.org/licenses/gpl-faq.html
Particulary this item of this FAQ talks about usage of GPL'ed modules.
http://www.fsf.org/licenses/gpl-faq.html#IfInterpreterIsGPL
S> Thanks Sami
--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
| Ilya Martynov (http://martynov.org/) |
| GnuPG 1024D/323BDEE6 D7F7 561E 4C1D 8A15 8E80 E4AE BE1A 53EB 323B DEE6 |
| AGAVA Software Company (http://www.agava.com/) |
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
------------------------------
Date: Thu, 06 Sep 2001 16:41:50 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: PERL modules and GPL license
Message-Id: <3b97a74e.726e$122@news.op.net>
In article <30586a1d.0109060149.2fa2141a@posting.google.com>,
Samppa <sami@xenetic.fi> wrote:
>I am planning to use PERL modules which are publised under
>GPL license. I am not changing the code of these modules just
>using them.
>
>What is your opinion, how does these modules (under GPL)
>affect to my code licensing and the availability
>to my source code ?
The GPL requires that your entire program be released under the terms
of the GPL. The would mean that you are required to make the source
code available.
The modules may be available under an alterative license. (Perl
modules are often available under the 'Artistic license'.)
If a module is only available under the GPL, that means the author
does not want to let you use it in non-free software. If you will not
make your source code available, and you will not release your
software under the GPL, then you may not use the module.
>Can I distribute the code without source codes ?
Not if your program contains a module that you have licensed under the GPL.
>We are planning to distribute the code as binary
>version only, but without license payments.
The license payments don't matter. If your program contains a
GPL-licensed module, you must release the source code.
--
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print
------------------------------
Date: Thu, 06 Sep 2001 16:48:00 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: PERL modules and GPL license
Message-Id: <3b97a8bf.7290$218@news.op.net>
In article <30586a1d.0109060149.2fa2141a@posting.google.com>,
Samppa <sami@xenetic.fi> wrote:
>We are planning to distribute the code as binary
>version only, but without license payments.
Sometimes companies whose activities cross the line of what
the GNU GPL permits plead for permission, saying that they
``won't charge money for the GNU software'' or such like. They
don't get anywhere this way. Free software is about freedom,
and enforcing the GPL is defending freedom. When we defend
users' freedom, we are not distracted by side issues such as
how much of a distribution fee is charged. Freedom is the
issue, the whole issue, and the only issue.
http://www.fsf.org/philosophy/selling.html
--
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print
------------------------------
Date: Thu, 6 Sep 2001 11:48:01 -0500 (CDT)
From: dennis100@webtv.net (BUCK NAKED1)
Subject: Permissions - Is nobody better?
Message-Id: <23953-3B97A8C1-30@storefull-244.iap.bryant.webtv.net>
[I thought I should repost this with a more appropriate subject line]
As I stated in another thread, my perl command "chmod" won't work from
one of my cgi scripts to "chmod" other files. Running as "user" there, I
get "permission denied" errors. That script is an online file manager
that I use to manage my website (much easier than using something
offline like Arachnophilia).
At other Linux hosts, I was also running as "user" and this script
worked; but this host says in order for it to work, he'll have to change
the ownership on that script, and run it as "nobody". Is this the only
way to do it? I really don't want to lose the security of running
scripts as "myself".
Also, I changed all the files and directories above them to 777, and
still cannot chmod from my filemgr script. I really don't like have all
those directories and files at 777 permission anyway. Anyone could
easily delete one of my directories/files with those permissions.
Regards,
Dennis
------------------------------
Date: Thu, 06 Sep 2001 09:00:37 -0700
From: Fred <fredcoyoteno@spamgo.com>
Subject: Regular Expression puzzle...
Message-Id: <3B979DA5.5B2@spamgo.com>
for me, anyway...I think I'm almost there, but...
I have data in the form of
XXX XXXXX XXXXXX
X X XXXXX XXX
X X X X XXXXXX XXXX
X X & X XXXXX
where X can be either a number or letter, all caps.
I need to collapse the single letters/single spaces.
ie,
X X X X YYYYY YYYY
to
XXXX YYYYY YYYY
and
X X & X XXXXX
to
XX&X XXXXX
etc.
I've tried combinations similar to (for letters only)
$test =~ s/([A-Z\&])\s([A-Z\&])\s/$1$2/g;
and
$testb =~ s/\s([A-Z\&])\s([A-Z\&])\s/$1$2/g
but I think I'm missing something ... any hints :-)
thanks
Fred
remove no@spam to reply via email
------------------------------
Date: 06 Sep 2001 16:59:06 GMT
From: trammell@haqq.hypersloth.invalid (John J. Trammell)
Subject: Re: Regular Expression puzzle...
Message-Id: <slrn9pfq00.r7v.trammell@haqq.hypersloth.net>
On Thu, 06 Sep 2001 09:00:37 -0700, Fred <fredcoyoteno@spamgo.com> wrote:
> for me, anyway...I think I'm almost there, but...
>
> I have data in the form of
>
> XXX XXXXX XXXXXX
> X X XXXXX XXX
> X X X X XXXXXX XXXX
> X X & X XXXXX
>
> where X can be either a number or letter, all caps.
>
> I need to collapse the single letters/single spaces.
[ ~ ] cat -n foo.pl
1 #!/usr/bin/perl -w
2 use strict;
3
4 while (<>)
5 {
6 s/(\b\w\b)/\\$1/g; # " X " -> " \X "
7 1 while s/(\\\w)\s+\1/$1$1/; # " \X \X " -> " \X\X "
8 s/\\(\w)/$1/g; # "\X" -> "X"
9 print;
10 }
11
[ ~ ] ./foo.pl
X X X YYY Z Z ZZ QQ
XXX YYY ZZ ZZ QQ
[ ~ ]
I'll let you handle the ampersand.
------------------------------
Date: Thu, 6 Sep 2001 19:02:06 +0200
From: Laocoon <Laocoon@eudoramail.com>
Subject: Re: Regular Expression puzzle...
Message-Id: <Xns9114C2FD8DAF3Laocooneudoramail@62.153.159.134>
1 while $test =~ s/ ([\w&]\s)/$1/;
Note that the first character in the match is a space and not \s because \s
will also match \n (and its shorter).Hope this helps..
------------------------------
Date: Thu, 06 Sep 2001 17:54:22 GMT
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Regular Expression puzzle...
Message-Id: <slrn9pfamh.4k1.tadmc@tadmc26.august.net>
Fred <fredcoyoteno@spamgo.com> wrote:
>where X can be either a number or letter, all caps.
>
>I need to collapse the single letters/single spaces.
>
>ie,
>
>X X X X YYYYY YYYY
>to
>XXXX YYYYY YYYY
>
>and
>
>X X & X XXXXX
>to
>XX&X XXXXX
I think this does it:
$str =~ s{(\b([A-Z0-9])( (& )?\2)+)\b}
{ my $run = $1;
$run =~ tr/ //d;
$run;
}e;
Some of the parens should be non-capturing, but I didn't want
to clutter it up (any more than it already is).
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 06 Sep 2001 15:01:47 +0200
From: "H. Merijn Brand" <h.m.brand@hccnet.nl>
To: comp.lang.perl.misc
Subject: Re: Undef'ing multiple variables
Message-Id: <Xns911498E44782Merijn@192.0.1.90>
abigail@foad.org (Abigail) wrote in
news:slrn9pd8ee.hk3.abigail@alexandra.xs4all.nl:
> Yeah, except that doesn't undef @c - just its elements.
>
>
> An alternative would be to start all the variables you want to undef
> with a particular letter, say U. No other variables should start with U.
> Also, the variables should be package variables.
>
> Then you can undefine them using the little known function reset:
>
> reset "U";
Which is very errorprone if you (by accident) use a variable that also starts
with a 'U' but you don't want to reset.
A much cleaner way to do the same is to use a hash (%U) populated with the
variables you want to reset
@U{qw( a b c )} = ( 1, "x", [ 0, "12S" ] );
and later
%U = ();
--
H.Merijn Brand Amsterdam Perl Mongers (http://www.amsterdam.pm.org/)
using perl-5.6.1, 5.7.1 & 628 on HP-UX 10.20 & 11.00, AIX 4.2, AIX 4.3,
WinNT 4, Win2K pro & WinCE 2.11 often with Tk800.022 &/| DBD-Unify
ftp://ftp.funet.fi/pub/languages/perl/CPAN/authors/id/H/HM/HMBRAND/
------------------------------
Date: 6 Sep 2001 06:56:12 -0700
From: jonni@ifm.liu.se (Jonas Nilsson)
Subject: Re: Undef'ing multiple variables
Message-Id: <71734a2.0109060556.33db413@posting.google.com>
I've come up with a subroutine that works.
Try this:
<CODE>
my $Scalar="hello";
my @array=(1,2,3,4);
my %hash=('A' => 1, 'B' => 2);
sub my_undef {
while ($_=shift) {
undef ${$_},next if ref eq "SCALAR";
undef @{$_},next if ref eq "ARRAY";
undef %{$_},next if ref eq "HASH";
}
}
print "Scalar ".(defined $Scalar?"":"un")."defined\n";
print "Array ".(defined @array?"":"un")."defined\n";
print "Hash ".(defined %hash?"":"un")."defined\n";
my_undef(\$Scalar,\@array,\%hash);
print "Scalar ".(defined $Scalar?"":"un")."defined\n";
print "Array ".(defined @array?"":"un")."defined\n";
print "Hash ".(defined %hash?"":"un")."defined\n";
<END CODE>
/jN
------------------------------
Date: Thu, 06 Sep 2001 17:21:51 +0200
From: Tassilo von Parseval <Tassilo.Parseval@post.rwth-aachen.de>
Subject: Re: Undef'ing multiple variables
Message-Id: <3B97948F.3070408@post.rwth-aachen.de>
Jonas Nilsson wrote:
> I've come up with a subroutine that works.
Admittedly a nice and pleasantly exotic solution. Yet, it wont always work:
$a = "hello";
$b = \$a;
$c = \$b;
print ref $c;
__END__
REF
So $c would not be undef()ed since it is neither a SCALAR-, an ARRAY-
nor a HASH-ref.
> sub my_undef {
> while ($_=shift) {
> undef ${$_},next if ref eq "SCALAR";
> undef @{$_},next if ref eq "ARRAY";
> undef %{$_},next if ref eq "HASH";
> }
> }
Tassilo
--
$a=[(74,116)];$b=[($a->[1]-1,$a->[1]++,0x20)];$c=[(97,110)];$d=[($c->
[1]+1,$b->[1],"her")];for(@{[$a,$b,$c,$d]}){for(@{$_}){$_=~/\d+/?print
(chr($_)):print;}}$c=sub{$l=shift;[(0x20+$l-1,0x50,0x65,0x73-0x01,108
),(0x20,0x68,0x61,)]};print(map{chr($_)}@{($c->(1))});$h={a=>33*3,b=>
10**2+7,c=>"1"."0"."1",d=>0162};@h=sort(keys(%$h));for(@h){print(chr(
ord(chr($h->{$_}))))};
------------------------------
Date: 6 Sep 2001 16:51:13 GMT
From: Tina Mueller <tinamue@zedat.fu-berlin.de>
Subject: Re: Undef'ing multiple variables
Message-Id: <9n89i1$5so9g$1@fu-berlin.de>
Tassilo von Parseval <Tassilo.Parseval@post.rwth-aachen.de> wrote:
> Jonas Nilsson wrote:
>> I've come up with a subroutine that works.
> Admittedly a nice and pleasantly exotic solution. Yet, it wont always work:
> print ref $c;
> REF
> So $c would not be undef()ed since it is neither a SCALAR-, an ARRAY-
> nor a HASH-ref.
not to talk about GLOB, CODE, LVALUE, ...
--
http://www.tinita.de \ enter__| |__the___ _ _ ___
tina's moviedatabase \ / _` / _ \/ _ \ '_(_-< of
search & add comments \ \ _,_\ __/\ __/_| /__/ perception
------------------------------
Date: 6 Sep 2001 17:00:55 GMT
From: Tina Mueller <tinamue@zedat.fu-berlin.de>
Subject: Re: Undef'ing multiple variables
Message-Id: <9n8a46$5so9g$2@fu-berlin.de>
Tina Mueller <tinamue@zedat.fu-berlin.de> wrote:
>> So $c would not be undef()ed since it is neither a SCALAR-, an ARRAY-
>> nor a HASH-ref.
> not to talk about GLOB, CODE, LVALUE, ...
okay, ignore CODE and LVALUE... it's just GLOB...
i'm typing quicker than thinking i guess... :-/
--
http://www.tinita.de \ enter__| |__the___ _ _ ___
tina's moviedatabase \ / _` / _ \/ _ \ '_(_-< of
search & add comments \ \ _,_\ __/\ __/_| /__/ perception
------------------------------
Date: Thu, 06 Sep 2001 19:49:22 +0200
From: Tassilo von Parseval <Tassilo.Parseval@post.rwth-aachen.de>
Subject: Re: Undef'ing multiple variables
Message-Id: <3B97B722.7050802@post.rwth-aachen.de>
Tina Mueller wrote:
> Tina Mueller <tinamue@zedat.fu-berlin.de> wrote:
>>not to talk about GLOB, CODE, LVALUE, ...
>>
>
> okay, ignore CODE and LVALUE... it's just GLOB...
> i'm typing quicker than thinking i guess... :-/
No, CODE is in fact a valid ref-type so that's one more that should be
taken into account when rolling one's own undef() function.
Tassilo
--
$a=[(74,116)];$b=[($a->[1]-1,$a->[1]++,0x20)];$c=[(97,110)];$d=[($c->
[1]+1,$b->[1],"her")];for(@{[$a,$b,$c,$d]}){for(@{$_}){$_=~/\d+/?print
(chr($_)):print;}}$c=sub{$l=shift;[(0x20+$l-1,0x50,0x65,0x73-0x01,108
),(0x20,0x68,0x61,)]};print(map{chr($_)}@{($c->(1))});$h={a=>33*3,b=>
10**2+7,c=>"1"."0"."1",d=>0162};@h=sort(keys(%$h));for(@h){print(chr(
ord(chr($h->{$_}))))};
------------------------------
Date: Thu, 06 Sep 2001 17:46:58 +0100
From: Nial Stewart <nials@britain.agilent.com>
Subject: Win32:API module installation on a stand alone machine - solution.
Message-Id: <3B97A882.B0ABF1A1@britain.agilent.com>
I asked a few days ago for help with installing the Win32::API
on a machine, this is a report of how I did it for anyone
who does a google search on module installation in the future.
I'm a newbie with Perl and asked here how for help on my
installation of Win32::SerialPort. Dann Nunn replied ...
> You need to install the Win32::API module. Get it at this URL, then in DOS,
> type 'ppm install Win32-API.ppd' to install it:
> http://www.activestate.com/PPMPackages/5.6plus/Win32-API.ppd
The problem with this was that the .ppd file seemed to
point the installer to the .gz.tar file on the web
and the machine I was on then couldn't access the file
through the corporate firewall here (I think, it
came back with an error report about accessing the file).
I was able to manually grab the file with Netscape
but when it was unzipped I couldn't get anything to
install.
I did a bit more searching on groups.google.com and
came across a reference to the module at
www.activestate.com/packages/zips
I grabbed it from here, unzipped it and got a
directory and a .ppd file.
ppm install Win32-API
started the installer, but it reported that this was an
old version of the module and it didn't continue.
I did a bit of searching at the active state web site
and found the same module under
www.activestate.com/PPMPackages/zips/6xx-builds-only/
When downloaded and unzipped
ppm install Win32-API
worked first time.
When I took the module home and tried it on my laptop
(win98) I had to shorten the name of the .ppd
file so I could type it all, then that installation
went smoothly too.
I hope this is of use to anyone in the future who's having
problems installing modules.
As a footnote, I can't believe how useful Perl is. I'm a
hardware engineer and the ability to knock up quick test
scripts before proper software support is on line is
invaluable. All I need now is some method of driving
an inportb and outportb directly and I'll be happy.
Nial Stewart.
------------------------------
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.
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 1705
***************************************