[21838] in Perl-Users-Digest
Perl-Users Digest, Issue: 4042 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Oct 29 11:07:56 2002
Date: Tue, 29 Oct 2002 08:05:12 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Tue, 29 Oct 2002 Volume: 10 Number: 4042
Today's topics:
Re: ---logfile analysis <krahnj@acm.org>
Re: diff that ignores newlines? <jds@trumpetweb.co.uk>
Re: Dynamic fields in HTML with Database <nospankyou@spamlesslife.com>
Emacs modules for Perl programming (Jari Aalto+mail.perl)
Re: flock question addendum (Alan Barclay)
Re: How can I make a set of objects? <ler@cfmu.eurocontrol.int>
Re: OT Re: significance of 42 for perl, any?!? <rev_1318@hotmail.com>
Re: OT Re: significance of 42 for perl, any?!? <dover@nortelnetworks.com>
Re: Perl, Packages, Solaris and such things <twhu@lucent.com>
Re: Perl, Packages, Solaris and such things <tp601553@cia.gov>
pls help on array list pass to main from a function <email.erneo@msa.hinet.net>
Re: setreuid on AIX 5.1 with perl 5.6.1 (Villy Kruse)
Re: setreuid on AIX 5.1 with perl 5.6.1 (Mark)
Re: significance of 42 for perl, any?!? (Helgi Briem)
Re: significance of 42 for perl, any?!? <camerond@mail.uca.edu>
Re: significance of 42 for perl, any?!? <dover@nortelnetworks.com>
Re: Strange Performance Thing <un1@bluewin.ch>
Substitution inside array <md0nilhe@mdstud.chalmers.seNOSPAM>
Re: Substitution inside array <twhu@lucent.com>
Re: Substitution inside array <steven.smolinski@sympatico.ca>
tar --new-volume-script hangs (Francesc Guasch)
Trouble with .. operator in array context (Harik)
Re: Trouble with .. operator in array context <krahnj@acm.org>
Why is DESTROY called in scalar context? (tî'pô)
Re: Win32 performance data collection (Pumpkin)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 29 Oct 2002 10:57:37 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: ---logfile analysis
Message-Id: <3DBE699B.EEE857A0@acm.org>
Bill zhao wrote:
>
> I start my perl learning for a month now
> now I am processing a log file. its content format is like below:
>
> Oct 28 18:13:26 intra xinetd[504]: START: smtp pid=18217 from=192.168.0.87
>
> [snip]
>
> Oct 29 09:07:25 intra xinetd[504]: EXIT: smtp status=0 pid=19673
> duration=5(sec)
>
> *Note: Obviously the 2 lines contain the same value of pid belong to one
> consession.
>
> I am going to build a file each line of which contain a consession. the
> above log flile only put the consession start lines and exit lines, the
> same consession's start line and exit line do not always live together.
> Somebody can tell me a mechanism to do this work?
Here is one way to do it:
my %data;
while ( <DATA> ) {
my ( $pid ) = / pid=(\d+) /;
push @{$data{$pid}}, $_;
if ( @{$data{$pid}} == 2 ) {
print @{$data{$pid}};
delete $data{$pid};
}
}
__DATA__
Oct 28 18:13:26 intra xinetd[504]: START: smtp pid=18217
from=192.168.0.87
Oct 28 18:13:27 intra xinetd[504]: EXIT: smtp status=0 pid=18217
duration=1(sec)
Oct 28 18:13:27 intra xinetd[504]: START: smtp pid=18218
from=192.168.0.87
Oct 28 18:13:33 intra xinetd[504]: EXIT: smtp status=0 pid=18218
duration=6(sec)
Oct 28 19:06:53 intra xinetd[504]: START: smtp pid=18458
from=192.168.0.252
Oct 28 19:06:53 intra xinetd[504]: START: smtp pid=18459
from=192.168.0.252
Oct 28 19:06:53 intra xinetd[504]: START: smtp pid=18460
from=192.168.0.252
Oct 28 19:06:53 intra xinetd[504]: START: smtp pid=18461
from=192.168.0.252
Oct 28 19:06:59 intra xinetd[504]: EXIT: smtp status=0 pid=18458
duration=6(sec)
Oct 28 19:06:59 intra xinetd[504]: EXIT: smtp status=0 pid=18461
duration=6(sec)
Oct 28 19:06:59 intra xinetd[504]: EXIT: smtp status=0 pid=18459
duration=6(sec)
Oct 28 19:06:59 intra xinetd[504]: EXIT: smtp status=0 pid=18460
duration=6(sec)
Oct 29 08:58:33 intra xinetd[504]: START: smtp pid=19344
from=192.168.0.252
Oct 29 08:58:35 intra xinetd[504]: EXIT: smtp status=0 pid=19344
duration=2(sec)
Oct 29 09:07:20 intra xinetd[504]: START: smtp pid=19673
from=192.168.0.39
Oct 29 09:07:20 intra xinetd[504]: START: smtp pid=19675
from=192.168.0.92
Oct 29 09:07:24 intra xinetd[504]: EXIT: smtp status=0 pid=19675
duration=4(sec)
Oct 29 09:07:25 intra xinetd[504]: EXIT: smtp status=0 pid=19673
duration=5(sec)
John
--
use Perl;
program
fulfillment
------------------------------
Date: Tue, 29 Oct 2002 10:50:47 -0000
From: "Julia deSilva" <jds@trumpetweb.co.uk>
Subject: Re: diff that ignores newlines?
Message-Id: <UItv9.9050$8c5.6879@news-binary.blueyonder.co.uk>
Do a search on google for Beyond Compare
It is a Brilliant utility which I use daily.
"Paul M Lieberman" <paulmlieberman@alum.mit.edu> wrote in message
news:cc064bc7.0210281506.5af78cf8@posting.google.com...
> I'm looking for a utility, or perl code, that will compare two html
> files such that , if the two files display identically, this diff
> would consider them identical. Obviously, this means ignoring case
> inside tags, but not in displayed text. Also, <a><b>text</a></b>
> should match <b><a>text</b></a>. More critically, it means that
> newlines should be ignored, but in a smart way.
>
> For instance, the following two pieces of text would be considered
> identical:
>
> <H3>
> <CENTER>Gergen's Promotion of Postmodernism </CENTER></H3>
> <P>As my quotation shows, <A
> href="#c9">Gergen (1991)
> </A></P>
>
>
> <center>
> <h3>Gergen's Promotion of Postmodernism</h3>
> </center>
> <p>As my quotation shows, <a href="#c9" name="cr9-4">Gergen (1991)</a>
> </p>
>
> Any ideas?
>
> - Paul M Lieberman
------------------------------
Date: Tue, 29 Oct 2002 09:47:53 GMT
From: "Snerzel" <nospankyou@spamlesslife.com>
Subject: Re: Dynamic fields in HTML with Database
Message-Id: <pan.2002.10.29.09.47.43.607883@spamlesslife.com>
On Tue, 29 Oct 2002 09:40:55 +0800, Corin wrote:
> This is very easy, but I can't find out the best way. I want to have a
> paragraph of text on a page in html eg The quick [brown] [fox] jumps over
> the [lazy] dog. I then want the reader to be able to input the data for
> [brown] [fox] and [lazy] with their own words and then produce a fresh html
> page with the new phrase. Ideally I'd like to have lots of phrases in a
> database to chose from also. The final stage would be to convert the new
> html document into a pdf for emailing - tho' I'm getting ahead of myself
> here I think. Does anyone know the best way for me to do this - i'm only a
> beginner - perhaps there is a script already written that I could utilise.
> Thanks
The best way is to learn perl and do it yourself.... Give a man a fish and
you feed him for one day. Teach him how to fish and you feed him for life.
------------------------------
Date: 29 Oct 2002 11:26:44 GMT
From: <jari.aalto@poboxes.com> (Jari Aalto+mail.perl)
Subject: Emacs modules for Perl programming
Message-Id: <perl-faq/emacs-lisp-modules_1035890715@rtfm.mit.edu>
Archive-name: perl-faq/emacs-lisp-modules
Posting-Frequency: 2 times a month
URL: http://tiny-tools.sourceforge.net/
Maintainer: Jari Aalto <jari.aalto@poboxes.com>
Announcement: "What Emacs lisp modules can help with programming Perl"
Preface
Emacs is your friend if you have to do anything comcerning software
development: It offers plug-in modules, written in Emacs lisp
(elisp) language, that makes all your programmings wishes come
true. Please introduce yourself to Emacs and your programming era
will get a new light.
Where to find Emacs/XEmacs
o Unix:
http://www.gnu.org/software/emacs/emacs.html
http://www.xemacs.org/
o Unix Windows port (for Unix die-hards):
install http://www.cygwin.com/ which includes native Emacs 21.x.
XEmacs port is bundled in XEmacs setup.exe available from
XEmacs site.
o Pure Native Windows port
http://www.gnu.org/software/emacs/windows/ntemacs.html
ftp://ftp.xemacs.org/pub/xemacs/windows/setup.exe
o More Emacs resources at
http://tiny-tools.sourceforge.net/ => Emacs resource page
Emacs Perl Modules
Cperl -- Perl programming mode
ftp://ftp.math.ohio-state.edu/pub/users/ilya/perl
http://www.perl.com/CPAN-local/misc/emacs/cperl-mode/
<ilya@math.ohio-state.edu> Ilya Zakharevich
CPerl is major mode for editing perl files. Forget the default
`perl-mode' that comes with Emacs, this is much better. Comes
standard in newest Emacs.
TinyPerl -- Perl related utilities
http://tiny-tools.sourceforge.net/
If you ever wonder how to deal with Perl POD pages or how to find
documentation from all perl manpages, this package is for you.
Couple of keystrokes and all the documentaion is in your hands.
o Instant function help: See documentation of `shift', `pop'...
o Show Perl manual pages in *pod* buffer
o Grep through all Perl manpages (.pod)
o Follow POD references e.g. [perlre] to next pod with RETURN
o Coloured pod pages with `font-lock'
o Separate `tiperl-pod-view-mode' for jumping topics and pages
forward and backward in *pod* buffer.
o Update `$VERSION' variable with YYYY.MMDD on save.
o Load source code into Emacs, like Devel::DProf.pm
o Prepare script (version numbering) and Upload it to PAUSE
o Generate autoload STUBS (Devel::SelfStubber) for you
Perl Module (.pm)
TinyIgrep -- Perl Code browsing and easy grepping
[TinyIgrep is included in Tiny Tools Kit]
To grep from all installed Perl modules, define database to
TinyIgrep. There is example file emacs-rc-tinyigrep.el that shows
how to set up dattabases for Perl5, Perl4 whatever you have
installed
TinyIgrep calls Igrep.el to to do the search, You can adjust
recursive grep options, set search case sensitivity, add user grep
options etc.
You can find latest `igrep.el' module at
<http://groups.google.com/groups?group=gnu.emacs.sources> The
maintainer is Jefin Rodgers <kevinr@ihs.com>.
TinyCompile -- To Browse grep results in Emacs *compile* buffer
TinyCompile is a minor mode for *compile* buffer from where
you can collapse unwanted lines or shorten file URLs:
/asd/asd/asd/asd/ads/as/da/sd/as/as/asd/file1:NNN: MATCHED TEXT
/asd/asd/asd/asd/ads/as/da/sd/as/as/asd/file2:NNN: MATCHED TEXT
-->
cd /asd/asd/asd/asd/ads/as/da/sd/as/as/asd/
file1:NNN: MATCHED TEXT
file1:NNN: MATCHED TEXT
End
------------------------------
Date: 29 Oct 2002 12:31:09 GMT
From: gorilla@elaine.furryape.com (Alan Barclay)
Subject: Re: flock question addendum
Message-Id: <1035894669.498612@elaine.furryape.com>
In article <FEgv9.50$S23b.16580778@news2.randori.com>,
TBN <ihave@noemail.com> wrote:
>Yes, but my computer is down for the afternoon, so I'm working with pen and
>paper *gasp* for a few hours and I was trying to work through the problem
>while I waited for the I.S. goons to come fix my machine. :-)
I'm amazed that you can post to usenet without a working computer.
------------------------------
Date: Tue, 29 Oct 2002 10:09:45 GMT
From: Jean-Louis Leroy <ler@cfmu.eurocontrol.int>
Subject: Re: How can I make a set of objects?
Message-Id: <sdiszlmuf7.fsf@wagtail.sup.cfmu.eurocontrol.be>
"Teh (tî'pô)" <teh@mindless.com> writes:
> How can I make a set of objects AKA How can I use a reference as a
> hash key?
Take a look at Set::Object, available from CPAN. HTH.
--
Jean-Louis
------------------------------
Date: Tue, 29 Oct 2002 10:58:31 +0100
From: Paul van Eldijk <rev_1318@hotmail.com>
Subject: Re: OT Re: significance of 42 for perl, any?!?
Message-Id: <aplm42$ja4$1@odysseus.uci.kun.nl>
Walter Roberson wrote:
> In article <3DBDBEBA.741A879D@qwest.com>, Daniel Berger
> <djberge@qwest.com> wrote:
> :Bob Dover wrote:
> :> Its the answer to the question about Life, the Universe, and
> :> Everything. We don't know what the question is, but when we do, its
> :> answer will be 42.
>
> :I thought the question was, 'What is 8x7?'
>
> "What do you get when you multiply 6 by 9?". But there are several
> reasons for believing that that's not the right Question for this
> Universe. [For example, if it were, then the Universe would have
> disappeared and been replaced with something even more bizarre and
> inexplicable.] --
> Everyone has a "Good Cause" for which they are prepared to Spam.
> -- Roberson's Law of the Internet
Have you ever calculated 6*9 in base-13 (instead of standard decimal)? :-)
I'm not sure tha Douglas intended it that way but...
--
'''
(0 0)
+----oOO----(_)----------+
| Paul van Eldijk |
| rev_1318@hotmail.com |
+-----------------oOO----+
|__|__|
|| ||
ooO Ooo
RTFM: No just an acronym, it's the LAW!
------------------------------
Date: Tue, 29 Oct 2002 09:55:40 -0600
From: "Bob Dover" <dover@nortelnetworks.com>
Subject: Re: OT Re: significance of 42 for perl, any?!?
Message-Id: <apmaui$lb0$1@bcarh8ab.ca.nortel.com>
"Walter Roberson" wrote...
>
> "[For example, if it were, then the Universe would have disappeared
> and been replaced with something even more bizarre and inexplicable.]
"Some say this has already happened..."
------------------------------
Date: Tue, 29 Oct 2002 07:16:00 -0500
From: "Tulan W. Hu" <twhu@lucent.com>
Subject: Re: Perl, Packages, Solaris and such things
Message-Id: <aplu64$kdm@netnews.proxy.lucent.com>
If you want to use apache 1.3, you must use mod_perl 1.0.
If you want to use apache 2.0, you must use mod_perl 2.0 (current is 1.99)
If you want to use mod_perl 2.0, you must use perl 5.8.
I have installed apache 1.3 and 2.0 with gcc 3.2 and 2.95
without any problem on solaris 8.
hth
"David" <david444williams@yahoo.com> wrote in ...
> For the past week, I have been trying to get working the following
> perl setup:
> - apache + mod_perl + perl + solaris 9
>
> Is there a recommended combination of versions???
> eg.
> - solaris 9 (core install, developer install, etc)
> - perl (5.6, 5.8, 32/64 bit)
> - mod_perl (1.0 or 2.0)
> - apache (1.3 or 2.x)
------------------------------
Date: Tue, 29 Oct 2002 13:57:07 GMT
From: Tweetie Pooh <tp601553@cia.gov>
Subject: Re: Perl, Packages, Solaris and such things
Message-Id: <Xns92B68DEE2BD41TweetiePooh@62.253.162.105>
david444williams@yahoo.com (David) honoured comp.lang.perl.misc on Tue 29 Oct
2002 12:11:54a with news:cdca58e3.0210281611.480feda1@posting.google.com:
> I have been running in many problems including:
> - installed solaris with perl, then had problems compiling mod_perl
> - installed solaris core install, then had problems with gcc
> - compiling DBI-Oracle but errors between 32bit and 64bit oracle oci
> - compiling with gcc 3.2 when gcc 2.95 may be better
>
It does work with Solaris 8. Apache 1.3, gcc 3.2.
To build 32 bit
export ABI=32
on configure line ensure you link (LDFLAGS) to ORACLE_HOME/lib32,
$ORACLE_HOME/rdbms/lib32 and $ORACLE_HOME/network/lib32. Prob don't need all
of these. Use -L and -R for all.
If using ccs ld you will be OK, if gnu ld then also use --export-dynamic.
I use gcc from sunfreeware, built perl 5.8 from source.
DBD::Oracle need same care as mod_perl.
------------------------------
Date: Wed, 30 Oct 2002 22:50:30 +0800
From: "PT" <email.erneo@msa.hinet.net>
Subject: pls help on array list pass to main from a function
Message-Id: <apm7a0$rii@netnews.hinet.net>
say if I have a configuration file looks as below:
"filename1", "string a1", "string b1"
"*.log", "string a", "string b"
How can I pass the value of three parameters $filename, $stringA, $stringB
into an array list and to be called by MainProgram(@ListName)?
** including the wildcard * expand?
Thanks in advance
------------------------------
Date: 29 Oct 2002 08:24:30 GMT
From: vek@station02.ohout.pharmapartners.nl (Villy Kruse)
Subject: Re: setreuid on AIX 5.1 with perl 5.6.1
Message-Id: <slrnarshdt.btc.vek@station02.ohout.pharmapartners.nl>
On Tue, 29 Oct 2002 06:25:22 GMT,
techcog@acme.N3T <techcog@acme.N3T> wrote:
>Villy Kruse wrote:
>
>>
>> Translated into ($<, $>) = (12345, 12345);
>> That sometimes works, sometimes it leaves the saved user id,
>> which may or may not be a problem. This all depends on the OS
>> in question.
>>
>
>Thanks for attempting to answer the original question. But you've
>only just danced around the issue setting up strawmen along the way.
>(or if you prefer, since it's halloween, scarecrows)
>
>But the problem lies with perl not AIX. I will fix perl to behave
>with AIX.
>
How do you plan to do that; perhaps the perl developers should be involed.
I could imagine a new POSIX-like module that maps setuid, setreuid,
seteuid, and setresuid and the corresponding setgid functions directly
to the C functions of the same name. Modifying the $< or the $> variables
in the POSIX::setuid function also makes its error behaviour a bit unusual.
Villy
------------------------------
Date: 29 Oct 2002 06:29:32 -0800
From: markm@pconline.com (Mark)
Subject: Re: setreuid on AIX 5.1 with perl 5.6.1
Message-Id: <ea864e99.0210290629.5626f035@posting.google.com>
"techcog@acme.N3T" <techcog@acme.N3T> wrote in message news:<4178283.QlpYd5TBz2@gryphon>...
> Villy Kruse wrote:
>
> >
> > Translated into ($<, $>) = (12345, 12345);
> > That sometimes works, sometimes it leaves the saved user id,
> > which may or may not be a problem. This all depends on the OS
> > in question.
> >
>
> Thanks for attempting to answer the original question. But you've
> only just danced around the issue setting up strawmen along the way.
> (or if you prefer, since it's halloween, scarecrows)
>
> But the problem lies with perl not AIX. I will fix perl to behave
> with AIX.
Try this, chown the script to the user that you want to run the
script as, then use chmod to set the setuid bit (4755). Somewhere in
your perl script, probably near the top, enter this line:
$< = $>;
This will set the real uid to the effective id.
-mark
------------------------------
Date: Tue, 29 Oct 2002 13:32:42 GMT
From: helgi@decode.is (Helgi Briem)
Subject: Re: significance of 42 for perl, any?!?
Message-Id: <3dbe8dd6.1160464369@news.cis.dfn.de>
On Tue, 29 Oct 2002 02:27:20 -0000, Andreas
=?iso-8859-1?Q?K=E4h=E4ri?= <ak@freeshell.org.REMOVE> wrote:
>Submitted by "Daniel Berger" to comp.lang.perl.misc:
>> Bob Dover wrote:
>>
>>> "Michele Dondi" wrote...
>>> > Is there any particular significance of 42 for perl or is it just my impression?
>>>
>>> Its the answer to the question about Life, the Universe, and Everything. We
>>> don't know what the question is, but when we do, its answer will be 42.
>>
>> I thought the question was, 'What is 8x7?'
>
>AFAIK, 8x7 is "8888888". You probably meant 8*7.
AFAIK, you are both wrong. 8*7 is not 42. 6*7 is.
--
Regards, Helgi Briem
helgi AT decode DOT is
A: Top posting
Q: What is the most irritating thing on Usenet?
- "Gordon" on apihna
------------------------------
Date: Tue, 29 Oct 2002 09:07:29 -0600
From: Cameron Dorey <camerond@mail.uca.edu>
Subject: Re: significance of 42 for perl, any?!?
Message-Id: <3DBEA431.7060503@mail.uca.edu>
Helgi Briem wrote:
> On Tue, 29 Oct 2002 02:27:20 -0000, Andreas
> =?iso-8859-1?Q?K=E4h=E4ri?= <ak@freeshell.org.REMOVE> wrote:
>
>
>>Submitted by "Daniel Berger" to comp.lang.perl.misc:
>>
>>>Bob Dover wrote:
>>>
>>>
>>>>"Michele Dondi" wrote...
>>>>
>>>>>Is there any particular significance of 42 for perl or is it just my impression?
>>>>>
>>>>Its the answer to the question about Life, the Universe, and Everything. We
>>>>don't know what the question is, but when we do, its answer will be 42.
>>>>
>>>I thought the question was, 'What is 8x7?'
>>>
>>AFAIK, 8x7 is "8888888". You probably meant 8*7.
>>
>
> AFAIK, you are both wrong. 8*7 is not 42. 6*7 is.
But you need to remember Arthur Dent's next line (may not be an exact
quote, I'm pulling it out of long-term memory): "I always felt that
there was something fundamentally wrong with the Universe."
We should probably also remember that the question was "found" long
before the program (Earth) was finished, due to a mishap with a time
machine and a semi-sentient coffee maker trying to brew tea (or some
such problem).
Context, context, context, ladies and gentlemen (something we who
program using perl should all be familiar with).
Cameron
--
Cameron Dorey
Associate Professor of Chemistry
University of Central Arkansas
Phone: 501-450-5938
camerond@mail.uca.edu
------------------------------
Date: Tue, 29 Oct 2002 09:51:47 -0600
From: "Bob Dover" <dover@nortelnetworks.com>
Subject: Re: significance of 42 for perl, any?!?
Message-Id: <apman9$ke4$1@bcarh8ab.ca.nortel.com>
"Cameron Dorey" wrote...
>
> We should probably also remember that the question was "found" long
> before the program (Earth) was finished, due to a mishap with a time
> machine and a semi-sentient coffee maker trying to brew tea (or some
> such problem).
>
> Context, context, context, ladies and gentlemen (something we who
> program using perl should all be familiar with).
Along those lines, let us not forget that first the answer (42) was found
by Deep Thought (?) and then the question was sought, which never made
it to conclusion.
------------------------------
Date: Tue, 29 Oct 2002 11:20:41 +0100
From: Sven <un1@bluewin.ch>
Subject: Re: Strange Performance Thing
Message-Id: <un1-49917D.11204129102002@zinews.unizh.ch>
In article <3DBD6A5B.4CD0FBC3@bbsrc.ac.uk>,
Simon Andrews <simon.andrews@bbsrc.ac.uk> wrote:
> It also works OK on perl 5.6.1 on an alpha (CTU 5.1), and under
> activeperl 5.6.1 on Windows. Something very strange must be happening
> on your machine. When you're in the midst of your 26 second wait what
> does top show is taking all the system resources??
Guess what :-)
---
11:12am up 4 days, 59 min, 2 users, load average: 0.46, 0.12, 0.04
77 processes: 75 sleeping, 2 running, 0 zombie, 0 stopped
CPU states: 98.6% user, 1.3% system, 0.0% nice, 0.0% idle
Mem: 126512K av, 123560K used, 2952K free, 0K shrd, 36140K buff
Swap: 136544K av, 0K used, 136544K free 46208K cached
PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME COMMAND
11704 root 25 0 3344 3344 1364 R 97.8 2.6 0:10 test
11701 root 16 0 1040 1040 820 R 1.9 0.8 0:01 top
579 root 15 0 1364 1364 1224 S 0.1 1.0 0:00 sshd
1 root 15 0 460 460 408 S 0.0 0.3 0:04 init
---
I'm not big in Perl internals, but is it possible that the regex engine
uses external libraries that are not usually bundled with Perl (i.e. in
the Perl RPM provided by RedHat 8)? I hate to do this, but I might have
to rip the whole thing down and install Perl from source.
Or could the problem be related to the text encoding? Maybe a library
needed to deal with UTF8 missing? I'm really clueless this time.
Thanks for any hint, Sven
------------------------------
Date: Tue, 29 Oct 2002 16:06:45 +0100
From: Henrik Nilsson <md0nilhe@mdstud.chalmers.seNOSPAM>
Subject: Substitution inside array
Message-Id: <3DBEA401.2E3A246C@mdstud.chalmers.seNOSPAM>
Hello,
Is there a way to carry out this task in one round:
@array =~ s/FIRST/SECOND/g;
(ie, replace all "FIRST" by "SECOND" in the whole array)
or will I have to do it loop-wise, element by element?
Thanks,
Henrik
------------------------------
Date: Tue, 29 Oct 2002 10:03:57 -0500
From: "Tulan W. Hu" <twhu@lucent.com>
Subject: Re: Substitution inside array
Message-Id: <apm812$ngf@netnews.proxy.lucent.com>
Have you tried it?
"Henrik Nilsson" <md0nilhe@mdstud.chalmers.seNOSPAM> wrote in message
> Hello,
>
> Is there a way to carry out this task in one round:
>
> @array =~ s/FIRST/SECOND/g;
>
> (ie, replace all "FIRST" by "SECOND" in the whole array)
>
> or will I have to do it loop-wise, element by element?
>
> Thanks,
>
> Henrik
------------------------------
Date: Tue, 29 Oct 2002 15:13:11 GMT
From: Steven Smolinski <steven.smolinski@sympatico.ca>
Subject: Re: Substitution inside array
Message-Id: <bAxv9.5562$Nf2.579010@news20.bellglobal.com>
Henrik Nilsson <md0nilhe@mdstud.chalmers.seNOSPAM> wrote:
> Is there a way to carry out this task in one round:
What's a round? If you mean 'without a loop,' then no. If that's not
what you mean, then ignore this post.
> @array =~ s/FIRST/SECOND/g;
>
> (ie, replace all "FIRST" by "SECOND" in the whole array)
>
> or will I have to do it loop-wise, element by element?
Well, someone's got to do a loop, either you or perl. You can do it
explicitly:
s/FIRST/SECOND/g for @array;
Or, if you're so inclined, you can try to hide that it's a loop with
map in void context (which is unnecessarily obfuscating):
map { s/FIRST/SECOND/g } @array;
But who cares if there's a loop? The operation you're performing is a
loop, after all. Are loops out of style these, days, that programmers
would hide them?
Steve
------------------------------
Date: 29 Oct 2002 07:57:05 -0800
From: frankieremovethis@etsetb.upc.es (Francesc Guasch)
Subject: tar --new-volume-script hangs
Message-Id: <12932a23.0210290757.3d1f6009@posting.google.com>
I'm writing a script that makes a backup using tar.
The tape is a Seagate thingie that has a changer. When the
tape is full it must send a command that loads the next tape.
This is done from tar with the argument: --new-volume-script "mtx next"
That works from shell script. But when I try to make a perl
script that uses this command it hangs when trying to load the next
tape.
This is the main part of the script:
open LOG ,">>/var/log/backup.log"
or die $!;
open TAR ,"$TAR_TOTAL $dir|" or die $!;
select LOG;
while (<TAR>) {
print;
}
close TAR;
Am I doing something wron ?
------------------------------
Date: 29 Oct 2002 00:55:57 -0800
From: h_a_r_i_k@yahoo.com (Harik)
Subject: Trouble with .. operator in array context
Message-Id: <48485166.0210290055.1d2fabf1@posting.google.com>
Hi,
I have the following one-liner
perl -e 'print join(" ", $ARGV[0] .. $ARGV[1]), "\n"' -- -4 0
which doesn't seem to be doing the expected thing. The same script seems
to work for other pairs of numbers such as:
$ perl -e 'print join(" ", $ARGV[0] .. $ARGV[1]), "\n"' -- -4 -3
-4 -3 -2 -1
$ perl -e 'print join(" ", $ARGV[0] .. $ARGV[1]), "\n"' -- 0 5
0 1 2 3 4 5
Also, the problem goes away once I hard-code the pair of numbers in:
$ perl -e 'print join(" ", -4 .. 0), "\n"'
-4 -3 -2 -1 0
What am I missing?
Thanks and regards,
harik
PS:
$ uname -a
CYGWIN_NT-5.0 <hostname> 1.3.12(0.54/3/2) 2002-07-06 02:16 i686 unknown
$ perl --version
This is perl, v5.6.1 built for cygwin-multi
[snip]
------------------------------
Date: Tue, 29 Oct 2002 11:16:34 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Trouble with .. operator in array context
Message-Id: <3DBE6E0B.6DEBD0A9@acm.org>
Harik wrote:
>
> I have the following one-liner
> perl -e 'print join(" ", $ARGV[0] .. $ARGV[1]), "\n"' -- -4 0
> which doesn't seem to be doing the expected thing. The same script seems
> to work for other pairs of numbers such as:
> $ perl -e 'print join(" ", $ARGV[0] .. $ARGV[1]), "\n"' -- -4 -3
> -4 -3 -2 -1
> $ perl -e 'print join(" ", $ARGV[0] .. $ARGV[1]), "\n"' -- 0 5
> 0 1 2 3 4 5
> Also, the problem goes away once I hard-code the pair of numbers in:
> $ perl -e 'print join(" ", -4 .. 0), "\n"'
> -4 -3 -2 -1 0
> What am I missing?
Change the values of @ARGV from strings to numbers, "0" doesn't appear
to work on the right hand side of .. (bug?).
perl -e 'print join(" ", $ARGV[0]+0 .. $ARGV[1]+0), "\n"' -- -4 0
John
--
use Perl;
program
fulfillment
------------------------------
Date: Tue, 29 Oct 2002 10:37:58 +0200
From: "Teh (tî'pô)" <teh@mindless.com>
Subject: Why is DESTROY called in scalar context?
Message-Id: <8uhsru8433uhp1sqld26js8dvl8kcdu60b@4ax.com>
I wrote a trivial test and DESTROY seems to be called in scalar
context, is this always so?
I would have expected void context. I don't know if this has any
significance, just wondering.
------------------------------
Date: 29 Oct 2002 05:27:28 -0800
From: supercyberedu@yahoo.com.ar (Pumpkin)
Subject: Re: Win32 performance data collection
Message-Id: <ff537f34.0210290527.39145650@posting.google.com>
OH come on, I have already read about Perflib,
http://www.bybyte.de/jmk/docs/Perl5
The problem is that I don't have any clue even reading that,
----------------------------------------------------------------------------
use Win32::PerfLib;
($machine) = @ARGV;
Win32::PerfLib::GetCounterNames($machine, \%counter);
%r_counter = map { $counter{$_} => $_ } keys %counter;
$websvc = $r_counter{"Web Service"};
$isapi = $r_counter{"Current ISAPI Extension Requests"};
$connection = $r_counter{"Current Connections"};
$perf = new Win32::PerfLib($machine);
if(!$perf)
{
die "Can't open PerfLib of $machine!\n";
}
----------------------------------------------------------------------------
I reached to this point, with that I suppose I am searching for the id
of the object's info I need, but I don't have any idea how to go on,
because there is not enough documentation almost for me. Reading
counters.hlp from nt4 resource kit, we found out that this two objects
are PERF_COUNTER_RAWCOUNT Data,
but what is the next step ?
------------------------------
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 4042
***************************************