[19978] in Perl-Users-Digest
Perl-Users Digest, Issue: 2173 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Nov 21 14:06:36 2001
Date: Wed, 21 Nov 2001 11: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)
Message-Id: <1006369512-v10-i2173@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 21 Nov 2001 Volume: 10 Number: 2173
Today's topics:
.htaccess with Perl <jon_rew@nospam.learn-it.demon.co.uk>
Re: .htaccess with Perl <tony_curtis32@yahoo.com>
Re: a beginner (John J. Trammell)
Re: a beginner <bernard.el-hagin@lido-tech.net>
Re: a beginner <5l259r001@sneakemail.com>
Re: a simple question <Tassilo.Parseval@post.rwth-aachen.de>
About @INC contents - help, please <seas@sandy.ru>
Re: Absolute newbie question: Which book? <camerond@mail.uca.edu>
Re: Bitwise Operators - How to use? <josef.moellers@fujitsu-siemens.com>
Re: Bitwise Operators - How to use? (Mark Jason Dominus)
Re: Can I avoid 2 passes? <bart.lateur@skynet.be>
Re: Can I avoid 2 passes? <godzilla@stomp.stomp.tokyo>
Re: Can I avoid 2 passes? <bart.lateur@skynet.be>
Re: Can I avoid 2 passes? <godzilla@stomp.stomp.tokyo>
Re: Can I avoid 2 passes? <godzilla@stomp.stomp.tokyo>
Capture stdout from subs <sguazt@infodrome.net>
Commandline Arguments <jkezar@doc.state.vt.us>
Re: Commandline Arguments <Tassilo.Parseval@post.rwth-aachen.de>
Digest of stupidity for the lazy <5l259r001@sneakemail.com>
Re: File locking question <Laocoon@eudoramail.com>
Re: File position of of every word in a file <bart.lateur@skynet.be>
Re: has anyone tried activestate perl under solaris? <uri@stemsystems.com>
Re: how to calculate the CRC of a string... <no_mto@hotmail.com>
Re: how to calculate the CRC of a string... <bart.lateur@skynet.be>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 21 Nov 2001 18:32:55 -0000
From: "Jonathan Rew" <jon_rew@nospam.learn-it.demon.co.uk>
Subject: .htaccess with Perl
Message-Id: <1006368074.25508.0.nnrp-01.c2def305@news.demon.co.uk>
Hi
I have set up a password protected directory on my site and want to use Perl
to gain access to it. The Website is on an Apache server and I have already
set up the username and password. Is there any way that I can do it?
Thanks
Jonathan Rew
------------------------------
Date: Wed, 21 Nov 2001 12:51:12 -0600
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: .htaccess with Perl
Message-Id: <87pu6cgdpb.fsf@limey.hpcc.uh.edu>
>> On Wed, 21 Nov 2001 18:32:55 -0000,
>> "Jonathan Rew" <jon_rew@nospam.learn-it.demon.co.uk> said:
> Hi I have set up a password protected directory on my
> site and want to use Perl to gain access to it. The
> Website is on an Apache server and I have already set up
> the username and password. Is there any way that I can
> do it?
LWP::UserAgent
hth
t
--
Oh! I've said too much. Smithers, use the amnesia ray.
------------------------------
Date: Wed, 21 Nov 2001 11:00:46 -0600
From: trammell@haqq.hypersloth.invalid (John J. Trammell)
Subject: Re: a beginner
Message-Id: <slrn9vnni9.vb6.trammell@haqq.el-swifto.com>
On 21 Nov 2001 07:47:02 -0800, Mario <fijc2001@yahoo.com> wrote:
> Hi gays
> I need to know free good and fast tutorials in the web to learn PERL
> in CGI applications
> regards
Finally, the secret connection between CGI and homosexuality is revealed.
--
Only a very small fraction of our DNA does anything; the rest is all
comments and ifdefs.
------------------------------
Date: 21 Nov 2001 17:12:37 GMT
From: Bernard El-Hagin <bernard.el-hagin@lido-tech.net>
Subject: Re: a beginner
Message-Id: <slrn9vnr31.qsr.bernard.el-hagin@gdndev25.lido-tech>
On Wed, 21 Nov 2001 11:00:46 -0600, John J. Trammell
<trammell@haqq.hypersloth.invalid> wrote:
> On 21 Nov 2001 07:47:02 -0800, Mario <fijc2001@yahoo.com> wrote:
>> Hi gays
>> I need to know free good and fast tutorials in the web to learn PERL
>> in CGI applications
>> regards
>
> Finally, the secret connection between CGI and homosexuality is revealed.
I was all set to reply to Mario's post, but then I saw the greeting
and I thought myself unqualified to do so. ;)
Cheers,
Bernard
------------------------------
Date: Wed, 21 Nov 2001 17:44:46 +0100
From: "Steffen Müller" <5l259r001@sneakemail.com>
Subject: Re: a beginner
Message-Id: <9tgq8f$287$05$2@news.t-online.com>
[ please use more descriptive subject lines ]
"Mario" <fijc2001@yahoo.com> schrieb im Newsbeitrag
news:192f48ce.0111210747.148cae71@posting.google.com...
| Hi gays
| I need to know free good and fast tutorials in the web to learn PERL
| in CGI applications
| regards
This is in the FAQ, really.
Something has even been posted to this newsgroup TODAY!
gPNK7.407$Fbh.171249664@news.frii.net
Other than that, you could just use google to search the web for tutorials.
There's plenty of them around and they're almost all free!
Steffen
--
$_=q;0cb212c210b0bb010c0113bb0c410c0b516c0bb3d212c2b0b0b016b6cb2b2c21010c0
b41110b3bba0e0c0d2c4b2b6bc013d2c0d0b01012b0b0;;s/\n//g;s/(\d)/$1<2?$1:'0'x
$1/ge;s/([a-f])/'1'x(ord($1)-97)/ge;$o=$_;push@o,substr($o,$_*8,8) for(0..
24);for(@o){print"\0"x(26-$i).chr(oct('0b'.($_)))."\r";$i++};print"\n"#stm
------------------------------
Date: Wed, 21 Nov 2001 17:44:28 +0100
From: "Tassilo v. Parseval" <Tassilo.Parseval@post.rwth-aachen.de>
Subject: Re: a simple question
Message-Id: <9tgllc$por$05$1@news.t-online.com>
On Wed, 21 Nov 2001 15:55:35 GMT, Ciaran McCreesh wrote:
> Tassilo v. Parseval wrote:
>> my $a = "sadsajkdfskjdfs(kj454sd)errttyyu";
>> $a =~ /.*\((.*)\).*/;
>
> I would have thought that the leading and trailing .* would be unnecessary
> and a performance hit. Since the regex isn't anchored, .* at the start
> simply forces the match to the end and gets it working backwards (since the
> OP said that there will only be one (), this does nothing). The .* at the
> end also just eats up CPU cycles, since who cares what's after the match?
It _is_ a performance hit, yes, and serves no additional purpose. More
to that, the use of $a has already been criticized so I can freely consider
this post one of my less useful ones. ;-)
Tassilo
--
Albrecht's Law:
Social innovations tend to the level of minimum tolerable well-being.
------------------------------
Date: Wed, 21 Nov 2001 20:26:47 +0300
From: "Andrew Sergievskiy" <seas@sandy.ru>
Subject: About @INC contents - help, please
Message-Id: <9tgnug$2da3$1@news.kis.ru>
Hi, All!
I need you help.
I am trying to install modules DBI, DBD to access Sybase database.
The feature is that I cannot install modules on their place and have to
place them in my home dir (my system is Solaris).
I made it compile DBI (Makefile.PL and then make) - it said 'completed', and
even compiled something (it really executed all cc without errors).
I am trying to install DBD::Sybase, It wants @INC points to DBI module and I
cannot do this, because all this is in my home. How to change this fucking
variable?
Can anybody help me? - I am not advanced user, I only need to access my
Sybase database.
With regards,
Andrew
------------------------------
Date: Wed, 21 Nov 2001 10:27:27 -0600
From: Cameron Dorey <camerond@mail.uca.edu>
Subject: Re: Absolute newbie question: Which book?
Message-Id: <3BFBD5EF.ED020047@mail.uca.edu>
"David H. Adler" wrote:
>
> In article <3BFA8336.A122DB41@mail.uca.edu>, Cameron Dorey wrote:
> >
> > I beg to differ. If you're just starting out, and particularly if you
> > just have experience on Windows, get LPW32S (the Gecko book), because
> > there is a good bit of stuff in the LLama (not the Camel) that is
> > confusing to a Window$ user, and it is NOT pointed out that is it
> > specific to *x. The newer stuff in 5.6 can be discovered after you have
> > mastered the basics.
>
> The one possible caveat here is the question of whether the gecko has
> been updated to reflect the recent revision of the llama.
This is true, and I did consider it in my answer, but IMHO the brand new
Perl programmer will find the easier-going in the Gecko to be more
advantageous than the totally-up-to-dateness of the Llama because there
is nothing (I think) in 5.003/4 (LPW32S) that is broken in 5.6 and s/he
will not need the newer stuff until s/he has mastered most of the Gecko
(and then the docs start to make sense, anyway).
Note: I have not mentioned two recently published beginning books
"Elements..." by Andrew Johnson and "...24 hours" by Clinton Pierce,
because I haven't read them, but they seem to have good reviews by
people here and might be considered by the original poster, too. I don't
remember offhand if they are post-5.6. Anyone have any comments on them?
Cameron
--
Cameron Dorey
Associate Professor of Chemistry
University of Central Arkansas
Phone: 501-450-5938
camerond@mail.uca.edu
------------------------------
Date: Wed, 21 Nov 2001 17:07:00 +0100
From: Josef =?iso-8859-1?Q?M=F6llers?= <josef.moellers@fujitsu-siemens.com>
Subject: Re: Bitwise Operators - How to use?
Message-Id: <3BFBD124.543FCC09@fujitsu-siemens.com>
Miguel Manso wrote:
> =
> Hi there.
> =
> I was reading the perlop man page an I saw the Bitwise operators
> section... I've read it but I can't figure how the REAL use for them.
> =
> Can someone point me some clues?
It's a rather technical issue. You need some knowledge of number systems
(binary numbers).
HTH,
-- =
Josef M=F6llers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize
-- T. Pratchett
------------------------------
Date: Wed, 21 Nov 2001 18:43:08 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: Bitwise Operators - How to use?
Message-Id: <3bfbf5bb.5534$3a9@news.op.net>
In article <pan.2001.11.21.15.24.12.136.2766@yahoo.com>,
Miguel Manso <mmanso@yahoo.com> wrote:
>I was reading the perlop man page an I saw the Bitwise operators
>section... I've read it but I can't figure how the REAL use for them.
>
>Can someone point me some clues?
Consider the 'mode' value that comes back from 'stat':
my $mode = (stat $file)[2];
The mode contains sixteen bits that represent various properties of a
file. For example, one bit determines whether or not the owner has
permission to write to the file:
if ($mode & 0200) {
# owner has permission to write to the file
}
Suppose you want to turn on this bit:
$newmode = $mode | 0200;
chmod $newmode, $file;
Or perhaps you want to turn it off:
$newmode = $mode & ~0200;
chmod $newmode, $file;
You would use 'vec' here, but the bit ops are more perspicuous.
--
@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: Wed, 21 Nov 2001 16:39:36 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Can I avoid 2 passes?
Message-Id: <u2mnvt0s9hc1fs0h54e6cou2oi531nsooh@4ax.com>
Godzilla! wrote:
>Here are some benchmark results which have not been
>falsely fabricated. As you know, map methods become
>less efficient with larger data samples, Frank.
>sub Time
> {
> timethese (1000000,
> {
> 'name1' =>
> '%users = map split (/:/, $_, 2), <DATA> ;',
>
> 'name2' =>
> 'while (<DATA>)
> { $Users{substr ($_, 0, index ($_, ":"))} = substr ($_, index ($_, ":") + 1); }',
> } );
> }
This tests NOTHING. As soon as the DATA has been read until the end,
nothing else happens. You should at least have reset the seek value for
this handle to what it was at startup.
--
Bart.
------------------------------
Date: Wed, 21 Nov 2001 10:17:00 -0800
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Can I avoid 2 passes?
Message-Id: <3BFBEF9C.BDF9F6F5@stomp.stomp.tokyo>
Bart Lateur wrote:
> Godzilla! wrote:
> >Here are some benchmark results which have not been
> >falsely fabricated. As you know, map methods become
> >less efficient with larger data samples, Frank.
> This tests NOTHING. As soon as the DATA has been read until the end,
> nothing else happens. You should at least have reset the seek value for
> this handle to what it was at startup.
Really? Here is a truly cute little test
script for you. Gosh, you sure love flaunting
how little you know about Perl. You make for
such an easy mark. Kinda funny, your tossing
so many temper tantrums, Sheila... err... Frank.
Godzilla! Queen Of Mind Munchers.
--
#!perl
seek (DATA, 0, 0);
while (<DATA>)
{ print $_; }
__DATA__
------------------------------
Date: Wed, 21 Nov 2001 18:41:38 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Can I avoid 2 passes?
Message-Id: <jatnvtsm5bj306ufa2qflmmohl59k62bis@4ax.com>
Godzilla! wrote:
>seek (DATA, 0, 0);
>while (<DATA>)
> { print $_; }
>__DATA__
I said "what it was at startup", not 0.
--
Bart.
------------------------------
Date: Wed, 21 Nov 2001 10:44:08 -0800
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Can I avoid 2 passes?
Message-Id: <3BFBF5F8.542B0F1C@stomp.stomp.tokyo>
Bart Lateur wrote:
> Godzilla! wrote:
> >Here are some benchmark results which have not been
> >falsely fabricated. As you know, map methods become
> >less efficient with larger data samples, Frank.
> This tests NOTHING. As soon as the DATA has been read until the end,
> nothing else happens. You should at least have reset the seek value for
> this handle to what it was at startup.
You are so funny!
"Never Give A Sucker An Even Break."
- W.C. Fields
Here ya go. You and others will note there is no
significant differences in the timing ratio of
Uri's standard issue map method and, my highly
imaginative and eloquent substring method, save
for results being smoothed by effects of opening
and closing a filehandle, repeatedly. Clearly,
accuracy is way diminished doing it your way.
I have an idea for you. This will help with your
frantic fragile masculine ego driven retort.
Post more falsely fabricated benchmark results
using a different fake name of yours, Frank.
Godzilla! Queen Of Belly Laughs.
--
CONTENTS OF TEST.TXT:
_____________________
<HTML>
GARBAGE
<img src="images/large/0010.jpg">
GARBAGE
<img src="images/tn/tn_0010.jpg">
<img src="images/large/0102.jpg">
GARBAGE
<img src="images/tn/tn_0102.jpg">
<img src="images/tn/tn_0215.jpg">
<img src="images/large/0215.jpg">
GARBAGE
</HTML>
BENCHMARK SCRIPT:
_________________
#!perl
print "Content-type: text/plain\n\n";
use Benchmark;
print "Run One:\n\n";
&Time;
print "\n\nRun Two:\n\n";
&Time;
print "\n\nRun Three:\n\n";
&Time;
sub Time
{
timethese (100000,
{
'name1' =>
'open (DATA, "test.txt");
%users = map split (/:/, $_, 2), <DATA> ;
close (DATA);',
'name2' =>
'open (DATA, "test.txt");
while (<DATA>)
{ $Users{substr ($_, 0, index ($_, ":"))} = substr ($_, index ($_, ":") + 1); }
close (DATA);',
} );
}
PRINTED RESULTS:
________________
Run One:
Benchmark: timing 100000 iterations of name1, name2...
name1: 49 wallclock secs (48.56 usr + 0.00 sys = 48.56 CPU) @ 2059.31/s
name2: 47 wallclock secs (46.96 usr + 0.00 sys = 46.96 CPU) @ 2129.47/s
Run Two:
Benchmark: timing 100000 iterations of name1, name2...
name1: 48 wallclock secs (48.39 usr + 0.00 sys = 48.39 CPU) @ 2066.54/s
name2: 46 wallclock secs (47.12 usr + 0.00 sys = 47.12 CPU) @ 2122.24/s
Run Three:
Benchmark: timing 100000 iterations of name1, name2...
name1: 48 wallclock secs (48.50 usr + 0.00 sys = 48.50 CPU) @ 2061.86/s
name2: 46 wallclock secs (47.02 usr + 0.00 sys = 47.02 CPU) @ 2126.75/s
------------------------------
Date: Wed, 21 Nov 2001 11:02:33 -0800
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Can I avoid 2 passes?
Message-Id: <3BFBFA49.DB45E7A7@stomp.stomp.tokyo>
Godzilla! wrote:
> Bart Lateur wrote:
> > Godzilla! wrote:
(snipped the funny parts)
> > >Here are some benchmark results which have not been
> > >falsely fabricated. As you know, map methods become
> > >less efficient with larger data samples, Frank.
> > This tests NOTHING. As soon as the DATA has been read until the end,
> > nothing else happens. You should at least have reset the seek value for
> > this handle to what it was at startup.
> Here ya go. You and others will note there is no
> significant differences in the timing ratio of
> Uri's standard issue map method and, my highly
> imaginative and eloquent substring method, save
> for results being smoothed by effects of opening
> and closing a filehandle, repeatedly. Clearly,
> accuracy is way diminished doing it your way.
Oh, oh, oh, my poor aging and addled mind! I have
linked to the wrong data base. No matter, no change.
Results are still smoothly skewed doing this your way.
Godzilla! Queen Of Addleland.
--
CONTENTS OF TEST2.TXT:
______________________
user1:pass1:uid1:gid1:gecos1:home1:shell1
user2:pass2:uid2:gid2:gecos2:home2:shell2
BENCHMARK SCRIPT:
_________________
#!perl
print "Content-type: text/plain\n\n";
use Benchmark;
print "Run One:\n\n";
&Time;
print "\n\nRun Two:\n\n";
&Time;
print "\n\nRun Three:\n\n";
&Time;
sub Time
{
timethese (100000,
{
'name1' =>
'open (DATA, "test2.txt");
%users = map split (/:/, $_, 2), <DATA> ;
close (DATA);',
'name2' =>
'open (DATA, "test2.txt");
while (<DATA>)
{ $Users{substr ($_, 0, index ($_, ":"))} = substr ($_, index ($_, ":") + 1); }
close (DATA);',
} );
}
PRINTED RESULTS:
________________
Run One:
Benchmark: timing 100000 iterations of name1, name2...
name1: 42 wallclock secs (41.97 usr + 0.00 sys = 41.97 CPU) @ 2382.65/s
name2: 41 wallclock secs (40.64 usr + 0.00 sys = 40.64 CPU) @ 2460.63/s
Run Two:
Benchmark: timing 100000 iterations of name1, name2...
name1: 41 wallclock secs (41.69 usr + 0.00 sys = 41.69 CPU) @ 2398.66/s
name2: 39 wallclock secs (40.75 usr + 0.00 sys = 40.75 CPU) @ 2453.99/s
Run Three:
Benchmark: timing 100000 iterations of name1, name2...
name1: 40 wallclock secs (41.69 usr + 0.00 sys = 41.69 CPU) @ 2398.66/s
name2: 41 wallclock secs (40.70 usr + 0.00 sys = 40.70 CPU) @ 2457.00/s
------------------------------
Date: Wed, 21 Nov 2001 17:39:18 +0100
From: "Marco Guazzone" <sguazt@infodrome.net>
Subject: Capture stdout from subs
Message-Id: <9tgl11$ncc$1@serv1.iunet.it>
Hi,
suppose you have a package with a method that write
some text to stdout, say:
package Writer;
sub write
{
print __PACKAGE__, ' write!!', "\n";
}
1;
Now suppose you have another package that want to
capture output produced by Writer->write() and store
it into memory; furthermore this output should not to be
displayed. Say:
package Reader;
use Writer();
sub read
{
# capture output produced by Writer->write();
}
1;
What can I put inside Reader->read method ?
I thought of using 'pipes'; that is:
sub read
{
my $self = shift;
my $pipe = new IO::Pipe();
my $pid;
if ($pid = fork()) {
# Parent <=> reader
$pipe->reader();
# here catch Writer output
while (<$pipe>) {
$self->{_data_read} .= $_;
}
wait;
}
elsif (defined $pid) {
# Child <=> writer
close STDOUT; # output will not be displayed
# associates stdout to pipe writer fh
open(STDOUT, '>&' . $pipe->fileno()) or die $!;
Writer->write(); # produce output
exit 0; # exit from child
}
else {
die 'cannot fork: ', $!;
}
warn 'READ: "', $self->{_data_read}, '"', "\n";
}
This works!!
But it is very inefficient (due to fork(), pipe,...).
So anyone has a better solution ?
Thank you in advance !!
Marco Guazzone
marco.guazzone@kerbero.com
------------------------------
Date: Wed, 21 Nov 2001 13:30:06 -0500
From: Joseph Kezar <jkezar@doc.state.vt.us>
Subject: Commandline Arguments
Message-Id: <3BFBF2AD.C15D4822@doc.state.vt.us>
How do I pass command line arguments to my perl script.
e.g. /usr/home/jkezar/perl/showdat.pl my_dat_file.dat
I want to pass the name of the data file to my perl script.
How?
--
Joseph Kezar
------------------------------
Date: Wed, 21 Nov 2001 19:38:33 +0100
From: "Tassilo v. Parseval" <Tassilo.Parseval@post.rwth-aachen.de>
Subject: Re: Commandline Arguments
Message-Id: <9tgsb9$lha$04$1@news.t-online.com>
On Wed, 21 Nov 2001 13:30:06 -0500, Joseph Kezar wrote:
> How do I pass command line arguments to my perl script.
> e.g. /usr/home/jkezar/perl/showdat.pl my_dat_file.dat
> I want to pass the name of the data file to my perl script.
> How?
These arguments are stored in @ARGV.
$ script.pl arg1 arg2
will therefore result in
@ARGV = ("arg1", "arg2")
Read about this (and other) special variables with 'perldoc perlvar'.
Tassilo
--
QOTD:
The only easy way to tell a hamster from a gerbil is that the
gerbil has more dark meat.
------------------------------
Date: Wed, 21 Nov 2001 18:21:32 +0100
From: "Steffen Müller" <5l259r001@sneakemail.com>
Subject: Digest of stupidity for the lazy
Message-Id: <9tgq8g$287$05$5@news.t-online.com>
If you're too lazy to read through all the crap it posted, you can have a
look at this digest of stupidity.
"Godzilla!" <godzilla@stomp.stomp.tokyo> rants in
news:3BFB084E.DADC0A98@stomp.stomp.tokyo...
| > > @Associative_Array = qw (user1:pass1:uid1:gid1:gecos1:home1:shell1
| > > user2:pass2:uid2:gid2:gecos2:home2:shell2);
|
| > This is NOT an associative array. It is an array. Learn the
| > difference.
|
| > And now you go back in your hole, you troll.
|
|
| You give up? Appears so. Frustrating, ain't I?
|
| An associative array today is called a hash. For a decade
| or more, it is said, "Call it a hash!" So, this expression
| "associative array" is free for use. Virtually none, actually
| none in this group use the expression associative array
| except for me. I view an array containing elements with
| associated values to be, of all things, an associative
| array.
| All three of you elected
| to respond to the same article of mine all within the
| same temporal period. All three of you reacted with
| identical thinking, identical logic along with identical
| intensity, identical vehemence and many other identical
| personality quirks; personal idioms, such as psychotically
| defending each other. It is as if, it is a certainty,
| all three of you share the same brain, the same thinking,
| the same logic and, the same personality.
Ever considered that it could be just some abstract concept called "common
sense"? Or even "reason"?
| Clever, ain't I? Want to continue playing mind games?
| Around here, I am certainly the best at mind games,
No. You had no argument why it cannot be common sense that makes us tell you
the same.
Steffen
--
$_=q;0cb212c210b0bb010c0113bb0c410c0b516c0bb3d212c2b0b0b016b6cb2b2c21010c0
b41110b3bba0e0c0d2c4b2b6bc013d2c0d0b01012b0b0;;s/\n//g;s/(\d)/$1<2?$1:'0'x
$1/ge;s/([a-f])/'1'x(ord($1)-97)/ge;$o=$_;push@o,substr($o,$_*8,8) for(0..
24);for(@o){print"\0"x(26-$i).chr(oct('0b'.($_)))."\r";$i++};print"\n"#stm
------------------------------
Date: Wed, 21 Nov 2001 19:10:43 +0100
From: Laocoon <Laocoon@eudoramail.com>
Subject: Re: File locking question
Message-Id: <Xns9160C32226942Laocooneudoramailcom@62.153.159.134>
*snip*
> Why are you reading the whole file at once? There is no reason.
I like it better that way..
>> close(IN);
>> `del input`;
>
> This is wrong in multiple ways. For one, don't use backticks to call
> an external program when you don't care for its output. If you had
> switched on warnings, Perl would have told you so. Second, *if* you
> use an external program, check for its success. Third, don't use an
> external program if a Perl builtin exists for the same purpose. "del"
> doesn't exist in many environments. See perldoc -f unlink. So the line
> should have been
>
> unlink "input" or die "Can't unlink 'input': $!";
Thanks i didn't know about that..
>> print OUT $in;
>> close(OUT);
>
> Your program only does (badly) what the OP said he's been doing anyway.
> The question was how to rename the newly written file to the name of
> the original input file. You don't even mention this.
Must be a misunderstanding..
------------------------------
Date: Wed, 21 Nov 2001 17:58:32 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: File position of of every word in a file
Message-Id: <n2qnvtog94aa294ni5lrs2illke7n5vtgp@4ax.com>
Rob van Strien wrote:
>How can I get the file position of each single word in a file?
>I can read the file line by line and chop it up in words, but
>the tell-function will always return the file position of the
>(end of the) line I'm on, not the words.
Get the seek value of the filehandle (= tell) before each read. Then
search for the word, either with index, or (preferably) with a regex. If
you use a regex, you can get the offset of the word by using $-[0], like
this:
$_ = 'Everything is very confusing.';
/\bvery\b/ and print "Found word at offset $-[0].\n";
This prints:
Found word at offset 14.
Note that it doesn't give a false positive for "Everything", thanks to
the /\b/.
So what you do next, is add the seek value that you stored, which should
be the offset of the start of the line in the file, with the offset of
the word within the line. Something like:
#! perl -w
open 0;
$_ = 'Everything is very confusing.';
while(my $seek = tell 0, defined ($_ = <0>)) {
while(/\bvery\b/g) {
print "Found word 'very' at offset $seek+$-[0].\n";
}
}
You'll get 2 positives; if you replace "/\bvery\b/" with "/very/", there
will be 4.
--
Bart.
------------------------------
Date: Wed, 21 Nov 2001 18:02:46 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: has anyone tried activestate perl under solaris?
Message-Id: <x78zd0c872.fsf@home.sysarch.com>
>>>>> "DB" == Daniel Berger <djberg96@hotmail.com> writes:
DB> "aaa" <nobody@nowhere.com> wrote in message
DB> news:3BFB046B.889982DB@nowhere.com...
>> Hi just wondering about people's opinion of activestate's perl
>> distribution for solaris?
>> If you've tried it, let me know what you like and dont like about
>> it.....
DB> I've tried it. Works fine. If you want the tools that come along
DB> with ActiveState's distro then use ActiveState. Otherwise, build
DB> your own Perl. Oh, and use gcc as your compiler if you build your
DB> own. I have yet to build Perl successfully on Solaris with their
DB> default cc.
solaris doesn't HAVE a default cc. there is a stub program called cc
which is a fronr end driver. but there are none of the backend
modules. you have to install gcc or buy sun's commercial c compiler.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
-- Stem is an Open Source Network Development Toolkit and Application Suite -
----- Stem and Perl Development, Systems Architecture, Design and Coding ----
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: Wed, 21 Nov 2001 19:10:08 +0100
From: "MAGiC MANiAC^mTo" <no_mto@hotmail.com>
Subject: Re: how to calculate the CRC of a string...
Message-Id: <9tgr00$2gqp$1@news.kabelfoon.nl>
Thats great news!, I though I have to write it by my self, grin... :)
I research my perl directory's to find out how I can get start with
a crc string calculation. But I can't find out where to start, because
theres no information in my perl that has the words: string::crc or
string::crc32
do you have a suggestion where I can find how to startup a crc string
calculation?
thanks for the help!
"Bart Lateur" <bart.lateur@skynet.be> schreef in bericht
news:bl3mvto79ivaql7kcol3sv4ih7q9qk2kcb@4ax.com...
> MAGiC MANiAC^mTo wrote:
>
> >How can I calculate the CRC of a string?...
> >(it doesn't matter if it is a crc16 or crc32)
>
> The modules String::CRC and String::CRC32, which exist for Windows Perl
> to on Activestate's site (start browing in the
> <http://www.activestate.com/PPMpackages/> directory).
>
> And as a sidenote: the module Digest::MD5 can be used for many of the
> same purposes, but with a much smaller chance of clashes, because the
> result contains a lot more bits: 128 instead of 16 or 32.
------------------------------
Date: Wed, 21 Nov 2001 18:39:36 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: how to calculate the CRC of a string...
Message-Id: <80tnvt4lj6tdgrtfs2p7rr3fn10m15gq7t@4ax.com>
MAGiC MANiAC^mTo wrote:
>I research my perl directory's to find out how I can get start with
>a crc string calculation. But I can't find out where to start, because
>theres no information in my perl that has the words: string::crc or
>string::crc32
>do you have a suggestion where I can find how to startup a crc string
>calculation?
You'll have to get the modules first. What perl installation do you
have? If your computer has a direct internet connection, it can fetch
the modules by itself, before installing them. On Activestate perl, use
the PPM utility. Just type "PPM" in a DOS window, and then you can do:
install String::CRC
at the command line.
On Unix, the CPAN module can do pretty much the same.
You can always download the modules yourself, and then do an install
from the local files.
--
Bart.
------------------------------
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 2173
***************************************