[19424] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 1619 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Aug 26 18:05:31 2001

Date: Sun, 26 Aug 2001 15:05:09 -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: <998863508-v10-i1619@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sun, 26 Aug 2001     Volume: 10 Number: 1619

Today's topics:
    Re: $1 as subroutine parameter - problems (Abigail)
    Re: $1 as subroutine parameter - problems (Eric Bohlman)
    Re: $1 as subroutine parameter - problems ctcgag@hotmail.com
    Re: expired Linux accounts check program in Perl <Tassilo.Parseval@post.rwth-aachen.de>
    Re: Flock This (Abigail)
    Re: Is element in array (Tim Hammerquist)
    Re: It's to AM for me to think (Logan Shaw)
    Re: It's to AM for me to think (Tassilo v. Parseval)
    Re: It's to AM for me to think (Mark Jason Dominus)
        Keylogging in perl <massacre0@yahoo.com>
    Re: Performance : Shell X Perl (Mark Jason Dominus)
    Re: Performance : Shell X Perl <bsh@rawbw.com>
    Re: perl comments (Malcolm Dew-Jones)
        Perl help (teleconnect)
    Re: Problems with fixed-length random access databases. (Mark Jason Dominus)
    Re: Problems with fixed-length random access databases. <dscarlett@optushome.com.au>
    Re: Problems with fixed-length random access databases. (Eric Bohlman)
    Re: simple question im sure (Mark Jason Dominus)
    Re: Statement modifiers?? (Malcolm Dew-Jones)
    Re: Telnet front-end (Logan Shaw)
    Re: Tie and complex hashes (Mark Jason Dominus)
        tut question <cetzel@midsouth.rr.com>
    Re: tut question <Tassilo.Parseval@post.rwth-aachen.de>
    Re: warnings with cgi will crash Win32 perl core <godzilla@stomp.stomp.tokyo>
    Re: Yet another regex question (Mark Jason Dominus)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: 26 Aug 2001 21:50:10 GMT
From: abigail@foad.org (Abigail)
Subject: Re: $1 as subroutine parameter - problems
Message-Id: <slrn9oirop.olb.abigail@alexandra.xs4all.nl>

Markus Laire (markus.laire@usa.net) wrote on MMCMXVI September MCMXCIII
in <URL:news:Xns9109A5A7BF1markuslaire@192.89.123.233>:
-: 
-: When I use $1 as parameter to subroutine, which does some regexp for that 
-: parameter and then tries to use parameter again, it is changed by that 
-: regexp because $_[0] seems to reference $1 which was given as parameter.

That's because Perl passes arguments by reference. You pass $1 as $_ [0],
which will be passed as a reference, then your regex will set $1 - modifying
$_ [0] too.

-: I can avoid this problem by calling subroutine as test(my $temp = $1) 
-: instead of test($1).
-: 
-: My question is then: Is there any other (more elegant/better ?) way to 
-: counter this problem than to create a temporary scalar ?
-: 
-: I know that 'my ($param) = @_;' in subroutine avoids this problem, but I 
-: want it to be optimized and tight.

So.... what is so non-optimized and/or non-tight about my ($param) = @_?
The fact it's making a copy? Well, that's what my $temp = $1 is doing too.

Of course, if you really care about efficiency, you wouldn't use a regex
to extract the first 3 characters in the first place. You'd use substr.



Abigail
-- 
perl -we'$;=$";$;{Just=>another=>Perl=>Hacker=>}=$/;print%;'
#    Three thrushes flying over
#    the harbor. A crawling
#    beetle. The Master.


------------------------------

Date: 26 Aug 2001 21:52:21 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: $1 as subroutine parameter - problems
Message-Id: <9mbr2l$8kv$2@bob.news.rcn.net>

Markus Laire <markus.laire@usa.net> wrote:
> Actually I don't mind about speed so much. I just like to write as tight 
> (and optimized) code as I can, as far as it's still readable.

You have to be careful, though, not to base your ideas of what's "tight" 
and "optimized" on superstition, and the empirical evidence shows that 
many if not most programmers have superstitions in such matters.  That's 
why most experienced programmers strongly discourage micro-optimization; 
it often involves sacrificing readability, maintainability, economy of 
effort, and sometimes even correctness for zero or even negative gains in 
speed or memory usage.

> I thought that test(my $temp = $1) is too long to be nice perl so I was 
> thinking a way to make it shorter. test("$1") is nice.

How are those superfluous quote marks "nice"?  In fact, putting quote
marks around variable names in sub calls is a very bad habit to get into,
because it will blow up on you when you need to pass any kind of reference
to a sub (the quotes will stringify the reference passed to the sub,
making it unusable as a reference).


------------------------------

Date: 26 Aug 2001 22:05:01 GMT
From: ctcgag@hotmail.com
Subject: Re: $1 as subroutine parameter - problems
Message-Id: <20010826180501.880$Gc@newsreader.com>

Samneric <samneric@tigerriverOMIT-THIS.com> wrote:

> > $text =~ /(.+)/;
>
> You just assigned $text to $1 the long way...
>
> > test($1);    # this won't work
>
> test($text);   # will this?
>
> And you're doing all this just to extract/print the first 3 characters of
> a string...

The original poster said the code has illustrative of the behavior under
discussion.  I guess he could use substr, but then it would no longer
illustrate the behavior it was intended to.  Is there some reason you think
he was lying, and that he actually plans to use the code as given in
some application?

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
                    Usenet Newsgroup Service


------------------------------

Date: Sun, 26 Aug 2001 22:32:36 +0200
From: Tassilo von Parseval <Tassilo.Parseval@post.rwth-aachen.de>
Subject: Re: expired Linux accounts check program in Perl
Message-Id: <3B895CE4.8080208@post.rwth-aachen.de>

Valentin 30IR976 wrote:

> I am writing a Perl program to check my Linux system with shadow
> password installed. I think I must check the /etc/shadow file, with
> something like:
> 
> ($field1,$field2,...)=split(..) -->extract the different fields from
> shadow file with ':' as separator.
> 
> But, I think I should make some calculus to check if an account has
> expired, but...what calculus?

Hmmh, not really a Perl-question. But, alas, have a look at 'man shadow' 
where you'll find a description of the several fields. I think it is the 
8th field that indicates for how many days (counted from the mythical 
start of the UNIX-universe 1/1/1970) an account has expired.

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: 26 Aug 2001 21:59:45 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Flock This
Message-Id: <slrn9oisao.olb.abigail@alexandra.xs4all.nl>

Rob - Rock13.com (rob_13@excite.com) wrote on MMCMXV September MCMXCIII
in <URL:news:Xns910798056573Erock13com@64.8.1.227>:
-- jtjohnston>
--
-- > Can someone show me how to do this better then?
--
-- What do you want to do better? If its a large file you could read 
-- line by line rather than slurping in the whole thing, less memory 
-- used.

Which is normally a good advice. However, reading in things line by
line and doing something for each line will mean it takes longer before
you've read the entire file. And since you have a shared lock, all other
processes wanting to write the file have to wait. It's impossible to
say which is "better" without qualifying it.



Abigail
-- 
perl -e '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
         / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / 
         % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %;
         BEGIN {% % = ($ _ = " " => print "Just Another Perl Hacker\n")}'


------------------------------

Date: Sun, 26 Aug 2001 19:00:40 GMT
From: tim@vegeta.ath.cx (Tim Hammerquist)
Subject: Re: Is element in array
Message-Id: <slrn9oiigv.s4.tim@vegeta.ath.cx>

Me parece que Tim Hammerquist <tim@vegeta.ath.cx> dijo:
> Me parece que Guy <guymal@__NOSPAM__hotmail.com> dijo:
> > How can test a scalar to see if it is an element in a given array?
> > Example:
> > @bla=("one","two","three");
> > 
> > if ("two" IS IN @bla) #returns true
> > {
> >     #this code would be executed
> > ....
> > }
> > 
> > if ("four" IS IN @bla)#returns false
> > {
> >     #this code would not be executed
> > }
> 
> You have three basic choices:
> 1. grep the list; often inefficient
> 2. foreach loop -> last at match; more efficient.
> 3. more complex algorithm, esp. if list/array is sorted

Oops.  Entirely forgot about the hash lookup.

my @array_to_search = (....) # some stuff here
my %hash_of_array   = map {$_, 1} @array_to_search;
if ( $hash_of_array{$element_to_find} ) {
    # do stuff
|

Not terribly robust right here, but...  ;)

HTH

[ snippage ]

-- 
Sometimes we can choose the path we follow.
Sometimes our choices are made for us.
And sometimes we have no choice at all.
    -- Morpheus, The Sandman


------------------------------

Date: 26 Aug 2001 15:26:21 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: It's to AM for me to think
Message-Id: <9mbm1d$4d2$1@charity.cs.utexas.edu>

In article <3B88B49F.5010200@post.rwth-aachen.de>,
Tassilo von Parseval  <Tassilo.Parseval@post.rwth-aachen.de> wrote:
>Logan Shaw wrote:
>> Just go through each item in the list.  Keep track of the largest one
>> you've seen so far, and if you see something larger, record it as the
>> largest one you've seen, and then keep going:
>
>And why not just sort it?
>
>$largest = (sort { $b <=> $a } @a) [0];
>
>Admittedly, this may be slower on very large arrays - O(n log(n)) - 
>while yours is O(n)....though I am not sure whether Perl's optimizations 
>would make up for that.

The answer is, there is a certain threshold of array size where the
sort method will start to become slower than the other method.  It may
be very large if the sort is carefully optimized, but the threshold
does exist.

So, which choice is best depends on:

   - whether performance matters
   - whether you think you know the approximate size of your arrays
   - whether you want scalability or you want to try to get the
     best performance for the case you think will be most common
   - whether you care about using temporary memory (the sort requires
     creating a copy of the list).

By the way, I just realized there is an optimization to my method
that also makes the code clearer in addition to being faster:

	@array = qw{ -111 6 5 7 89 3 76 };

	$largest = $array[0];	# assume first element is largest
	foreach my $i (@array)
	{
	    $largest = $i if $i > $largest;
	}

	print $largest, "\n";

And yes, this does work correctly in the case of an empty array.

  - Logan
-- 
"Our grandkids love that we get Roadrunner and digital cable."
(Advertisement for Time Warner cable TV and internet access, July 2001)


------------------------------

Date: 26 Aug 2001 21:00:39 GMT
From: Tassilo.Parseval@post.rwth-aachen.de (Tassilo v. Parseval)
Subject: Re: It's to AM for me to think
Message-Id: <9mbo1n$8u3$1@nets3.rz.RWTH-Aachen.DE>

On 26 Aug 2001 15:26:21 -0500, Logan Shaw <logan@cs.utexas.edu> wrote:

>>$largest = (sort { $b <=> $a } @a) [0];
>>
>>Admittedly, this may be slower on very large arrays - O(n log(n)) - 
>>while yours is O(n)....though I am not sure whether Perl's optimizations 
>>would make up for that.
> 
> The answer is, there is a certain threshold of array size where the
> sort method will start to become slower than the other method.  It may

Obviously with any size bigger than (at least) 9. :-) But see below.

[...]

> 	@array = qw{ -111 6 5 7 89 3 76 };
> 
> 	$largest = $array[0];	# assume first element is largest
> 	foreach my $i (@array)
> 	{
> 	    $largest = $i if $i > $largest;
> 	}
> 
> 	print $largest, "\n";
> 
> And yes, this does work correctly in the case of an empty array.

Ok, I was curious:


#! /usr/bin/perl -w

use strict;
use Benchmark qw(timethese cmpthese);

my $iterations = shift || 1000;
my $till	   = shift || 10000;

my $r = timethese($iterations, 
	{
		sort => sub {
					my @array = reverse (1 .. $till);
					my $largest = (sort { $b <=> $a } @array) [0];
					},
		loop => sub {
					my @array = reverse (1 .. $till);
					my $largest = $array[0];
					for my $i (@array) {
						$largest = $i if $largest < $i;
					}
					},
	});
	
cmpthese($r);

ethan@ethan:~$ perl benchmark.pl 10000 100
Benchmark: timing 10000 iterations of loop, sort...
        loop:  1 wallclock secs ( 1.15 usr +  0.00 sys =  1.15 CPU) @
            8695.65/s (n=10000)
        sort:  2 wallclock secs ( 1.70 usr +  0.00 sys =  1.70 CPU)
            @ 5882.35/s (n=10000)
        Rate sort loop
 sort 5882/s   -- -32%
 loop 8696/s  48%   --
			
ethan@ethan:~$ perl benchmark.pl 1000 1000
Benchmark: timing 1000 iterations of loop, sort...
        loop:  1 wallclock secs ( 1.13 usr +  0.00 sys =  1.13 CPU) @
            884.96/s (n=1000)
        sort:  2 wallclock secs ( 1.85 usr +  0.00 sys =  1.85 CPU) @ 
            540.54/s (n=1000)
        Rate sort loop
  sort 541/s   -- -39%
  loop 885/s  64%   --

I ran another 100000 iterations for an array of just 10 elements. Your
loop is still about 24% quicker....and, mind that, sort uses (ever since
5.6.0) merge-sort that has excellent behaviour in worst-case.

So, a pure Perl-loop of O(n) seems to be quicker than a C-optimized Perl-sort of
O(n log(n)).

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: Sun, 26 Aug 2001 21:38:18 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: It's to AM for me to think
Message-Id: <3b896c49.1442$373@news.op.net>

In article <9mbo1n$8u3$1@nets3.rz.RWTH-Aachen.DE>,
Tassilo v. Parseval <tassilo.parseval@post.rwth-aachen.de> wrote:
>On 26 Aug 2001 15:26:21 -0500, Logan Shaw <logan@cs.utexas.edu> wrote:
>
>>>$largest = (sort { $b <=> $a } @a) [0];
>>>
>>>Admittedly, this may be slower on very large arrays - O(n log(n)) - 
>>>while yours is O(n)....though I am not sure whether Perl's optimizations 
>>>would make up for that.
>> 
>> The answer is, there is a certain threshold of array size where the
>> sort method will start to become slower than the other method.  It may
>
>Obviously with any size bigger than (at least) 9. :-) But see below.
>
>[...]
>
>> 	@array = qw{ -111 6 5 7 89 3 76 };
>> 
>> 	$largest = $array[0];	# assume first element is largest
>> 	foreach my $i (@array)
>> 	{
>> 	    $largest = $i if $i > $largest;
>> 	}
>> 
>> 	print $largest, "\n";
>> 
>> And yes, this does work correctly in the case of an empty array.
>
>Ok, I was curious:
>
>
>
>ethan@ethan:~$ perl benchmark.pl 10000 100
>Benchmark: timing 10000 iterations of loop, sort...
>        loop:  1 wallclock secs ( 1.15 usr +  0.00 sys =  1.15 CPU) @
>            8695.65/s (n=10000)
>        sort:  2 wallclock secs ( 1.70 usr +  0.00 sys =  1.70 CPU)
>            @ 5882.35/s (n=10000)
>        Rate sort loop
> sort 5882/s   -- -32%
> loop 8696/s  48%   --
>			
>ethan@ethan:~$ perl benchmark.pl 1000 1000
>Benchmark: timing 1000 iterations of loop, sort...
>        loop:  1 wallclock secs ( 1.13 usr +  0.00 sys =  1.13 CPU) @
>            884.96/s (n=1000)
>        sort:  2 wallclock secs ( 1.85 usr +  0.00 sys =  1.85 CPU) @ 
>            540.54/s (n=1000)
>        Rate sort loop
>  sort 541/s   -- -39%
>  loop 885/s  64%   --
>
>I ran another 100000 iterations for an array of just 10 elements. Your
>loop is still about 24% quicker....and, mind that, sort uses (ever since
>5.6.0) merge-sort that has excellent behaviour in worst-case.
>

>So, a pure Perl-loop of O(n) seems to be quicker than a C-optimized Perl-sort of
>O(n log(n)).

That's because you cheated by picking a very special test case.  The
array elements are in order from largest to smallest.  This is the
*optimal* case for the loop code, because it only performs one
assignment, and is a common worst-case for sort functions.  In such a
case, the following algorithm is the most efficient:

        my $largest = $array[0];

You also neglected to say what version of Perl you are using.   In
recent versions of Perl,

        sort { $b <=> $a }

is more efficient than in old versions, because the function call to
the comparator is optimized away.

For an alternative (and probably more useful) look at this, see

        http://perlmonks.plover.com/index.pl?node_id=67059

-- 
@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: Sun, 26 Aug 2001 19:28:52 GMT
From: "Massacre Zero" <massacre0@yahoo.com>
Subject: Keylogging in perl
Message-Id: <U5ci7.10768$Z13.1170773025@newssvr17.news.prodigy.com>

I've been trying to write a basic keylogger as a project in Perl for
Windows.
Someone told me that I would have to look into 'windows hooks' for the
solution.
I have no experience on the subject and would appreciate any help.

-Ryan
massacre0@yahoo.com




------------------------------

Date: Sun, 26 Aug 2001 18:26:29 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: Performance : Shell X Perl
Message-Id: <3b893f54.10b2$bd@news.op.net>

In article <7nlmk9tmzb.fsf@eswssol001.elsegundoca.ncr.com>,
Brian Cantin  <bcc@eswssol001.elsegundoca.ncr.com> wrote:
>So, pick your poison: the ever changing virtual machine that Perl
>provides versus the relatively static but platform dependent UNIX
>toolkit.

I did pick my poison:

>mjd@plover.com (Mark Jason Dominus) writes:
>> In my experience it's a lot easier to write a portable Perl program
>> than a portable shell script.

I didn't think I could be clearer than that, but apparently it was not
clear enough.  Oh well, usenet.

My experience has been that Perl is less poisonous than shell scripts,
and I strongly dispute the guy who says it was the other way around.
I wonder if he's really tried doing both, or had to port a shell
script between (say) Solaris, IRIX, and HPUX.





-- 
@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: Sun, 26 Aug 2001 19:10:34 -0000
From: Brian Hiles <bsh@rawbw.com>
Subject: Re: Performance : Shell X Perl
Message-Id: <toiidam5qcqo9b@corp.supernews.com>

In comp.unix.shell Sandra Regina <sandra@ccuec.unicamp.br> wrote:
>   Is there anybody that could tell me what is better a shell or a perl
> program to do a specific task?
>   Is there any doc available that compares the two languages (for
> example perl and ksh, ou perl and csh)?

I'm confused; you're subject line states the criterion is performance,
but your question asks about a "specific task" that you do not say.
These are NOT the same questions.

However, read:

http://www.perl.com/pub/language/versus/csh.html
http://www.perl.com/pub/language/versus/*

and also look at look at:

http://cm.bell-labs.com/cm/cs/who/bwk/interps/pap.html

=Brian

P.S. You don't get something for nothing; the generality and
"compilation" phase of perl scanning its file code makes its startup
overhead relatively long but its execution relatively quick. Although
ksh is surprisingly fleet-footed for being, after all, an interpreter
that scans each code block four or five times (and BTW, is faster
than bourne shell!), its startup time (significant for small scripts)
is slower than bourne shell and much faster than perl.


------------------------------

Date: 26 Aug 2001 11:36:18 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: perl comments
Message-Id: <3b8941a2@news.victoria.tc.ca>

David Combs (dkcombs@panix.com) wrote:
: In article <3b796b7f@news.victoria.tc.ca>,
: Malcolm Dew-Jones <yf110@vtn1.victoria.tc.ca> wrote:
: >
: >
: >One useful area is after an __END__ .  Everything after this line is
: >ignored.
: >
: >I often put programming notes there, such as examples of things to be
: >parsed, or requirement notes I can read while programming, or bits of half
: >finished code I think I might want to use, or examples, etc. etc. etc. 
: >like a scratch pad area.
: >

: OK.  Now, suppose for test purposes you're also
: using __DATA__.


I don't claim this is always useful, but especially during initial
development I have found it to be useful often enough to count as a useful
trick to remember. 

No one says you need to use it if you don't like it.

It's also easy to kludge in both an __END__ and a data, just add a snippet
something like (from memory, this e.g. not tested, in my experience the
DATA handle points to the __END__, but the tag names can be changed to
what ever works)

	#!perl
	
	{ 1 while ( <DATA> !~ m/^__DATA__$/ ) ; } # skip some of DATA
	
	-perl-program-goes-here-

	__END__
	programing notes go here, examples of data to be parsed etc,
	old code saved as examples and for cut and paste when editing

	__DATA__
	real data

(kludgey but useful for the ad-hoc style tools that are never really
finished)


------------------------------

Date: Sun, 26 Aug 2001 17:35:48 -0400 (EDT)
From: teleconnect@webtv.net (teleconnect)
Subject: Perl help
Message-Id: <23506-3B896BB4-199@storefull-223.iap.bryant.webtv.net>

Hey group, 

Im a newbie to Perl so I have a newbie question. Here it goes.

What exactly does localizing variables do? In other words, what is its
purpose? Also are there any differences between "my" and "local"? I'v
read "local" is replaced with "my" in Perl 5, yet I see some programmers
using it, even in Matt's Script Archive.

Thanks alot to anyone that helps me!

P.S. Hope no one cares im @webtv.net



------------------------------

Date: Sun, 26 Aug 2001 18:31:16 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: Problems with fixed-length random access databases.
Message-Id: <3b894074.10d2$279@news.op.net>

In article <yo1i7.22829$A5.70124@news1.eburwd1.vic.optushome.com.au>,
David Scarlett <dscarlett@optushome.com.au> wrote:
>----------------
>my($pstring) = "LSfC";        # Pack control string.
>my($psize) = length($pstring);    # Length of each record.
>open(DB,"+>>ping.dat") || die "Error: Cannot open ping.dat. $!\n";

This opens the file for read-write, but with special append
semantics.  Append semantics usually mean that *every* write appears
at the end of the file.

+>> is almost never useful.  You wanted +< here instead.
-- 
@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: Sun, 26 Aug 2001 21:48:38 GMT
From: "David Scarlett" <dscarlett@optushome.com.au>
Subject: Re: Problems with fixed-length random access databases.
Message-Id: <W8ei7.23120$A5.70965@news1.eburwd1.vic.optushome.com.au>

"Mark Jason Dominus" <mjd@plover.com> wrote in message
news:3b894074.10d2$279@news.op.net...
> In article <yo1i7.22829$A5.70124@news1.eburwd1.vic.optushome.com.au>,
> David Scarlett <dscarlett@optushome.com.au> wrote:
> >----------------
> >my($pstring) = "LSfC";        # Pack control string.
> >my($psize) = length($pstring);    # Length of each record.
> >open(DB,"+>>ping.dat") || die "Error: Cannot open ping.dat. $!\n";
>
> This opens the file for read-write, but with special append
> semantics.  Append semantics usually mean that *every* write appears
> at the end of the file.
>
> +>> is almost never useful.  You wanted +< here instead.

Ahh, so that's the problem. Thanks! (Hmmm, now why didn't Randal L. Schwartz
meantion that?.......) ;-)


--
David Scarlett
dscarlett@optushome.com.au
http://www.listen.to/artifice/
http://members.optushome.com.au/dscarlett/

"Why am I talking to myself? More importantly, why am I expecting a reply?"
        -Daria




------------------------------

Date: 26 Aug 2001 22:05:00 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: Problems with fixed-length random access databases.
Message-Id: <9mbrqc$8kv$3@bob.news.rcn.net>

David Scarlett <dscarlett@optushome.com.au> wrote:
>         if (@_[0,1] == (unpack($pstring,$buf))[0,1]) {    # Record found.

You can't compare lists like this.


------------------------------

Date: Sun, 26 Aug 2001 18:11:30 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: simple question im sure
Message-Id: <3b893bd2.1079$2a5@news.op.net>

In article <20010826085209.04385.00004207@mb-mh.aol.com>,
 .net.org.us.tv.cc <lordralph65@aol.com> wrote:
>woo hoo! i figured it out. the problem with
>the program takes place 2 lines AFTER
>the line specified in the error..

Yes, it's an unfortunate bug in Perl that when an error occurs in the
condition of an 'elsif' clause, Perl reports the line number of the
'if' part instead.  That's just something you will need to know about
Perl----if it complains about the 'if', you need to look at the
'elsif' parts also.

But another thing you might want to learn from this experience:  You
said that 


        if($variable == 1)

generated the warning, but that the warning went away when you changed
it to say:

        if($variable == 193901)
or      if($variable == 0x01)

But that appears to have been a complete fantasy on your part.
Wouldn't it be a good idea to try to adjust your brain so that you
don't mislead yourself this way in the future?

-- 
@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: 26 Aug 2001 11:17:07 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: Statement modifiers??
Message-Id: <3b893d23@news.victoria.tc.ca>

Ilya Martynov (ilya@martynov.org) wrote:
: >>>>> On 25 Aug 2001 09:49:21 GMT, dkcombs@panix.com (David Combs) said:

: DC> Anyway, about assertions.

: DC> You really need macros to do them "right".

: DC> You define assert *as a macro*.

: DC> So that Assert(i > j) generates:

: DC>    if not (i > j) {
: DC>       either-die-or-warn-or-goIntoDebugger("Assertion Failed: " . "i > j")
: DC>     }

: DC> (not exact syntax, but at least readable)

: You can implement same thing in Perl using source filters.


but I don't think you even need to.

I tested something very similar, (I forget exactly what I'm afraid, so I
may be wrong here). 

If you define your 'Assert' sub as a do nothing then it is either
optimized away, or the sub itself is so optimized that there's effectively
no runtime added to the script, only compile time, (but compile time
doesn't count since a macro preprocessor or filter would always have to
parse the macros anyways).

(perhaps my test was of &the_sub; calls, (implicit parameters) so it might
not apply ?) 



------------------------------

Date: 26 Aug 2001 15:40:42 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: Telnet front-end
Message-Id: <9mbmsa$4i9$1@charity.cs.utexas.edu>

In article <3B892A9A.77B05CF9@physics.berkeley.edu>,
Antonio  <agm@physics.berkeley.edu> wrote:
>Yes it would be easier, but to my understanding of SSH, one needs to
>configure the hosts file on the remote server, in order to have a
>passwordless login.

I'm not an ssh expert, but I believe this can be done via files in the
home directory only (like $HOME/.shosts and $HOST/.ssh/known_hosts) and
that as long as you have a working sshd on the remote end and a working
ssh client on the local end, you don't need root access on either end.

Unfortunately, I haven't taken the time to probe the depths of ssh's
complicated conditional rules for authentication, so I can't tell you
how.

  - Logan
-- 
"Our grandkids love that we get Roadrunner and digital cable."
(Advertisement for Time Warner cable TV and internet access, July 2001)


------------------------------

Date: Sun, 26 Aug 2001 18:36:46 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: Tie and complex hashes
Message-Id: <3b8941be.1107$c9@news.op.net>

In article <R_Th7.1053$tS5.979870@typhoon2.gnilink.net>,
Mark Riehl <mark.riehl@agilecommunications.com> wrote:
>How do I use Tie for one of the nested hashes, for example:
>
>$RxTxData{$key}{statistics}{$key2}

        tie %{$RxTxData{$key}{statistics}{$key2}}, 'Tie::IxHash';

appears to work.  (Or similarly, if $r = $RxTxData{$key}{statistics}{$key2}, 
you may write   tie %$r, 'Tie::IxHash'; .)
-- 
@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: Sun, 26 Aug 2001 19:34:34 GMT
From: Chris Etzel <cetzel@midsouth.rr.com>
Subject: tut question
Message-Id: <3B8AA4DF.CF23438A@midsouth.rr.com>

Hey all,

I have 'Learning Perl' by Oreilly and it has helped me learn a bunch,
but unfortunately it is very vague on definition and usage of $_ and @_
 ... any suggestions on getting clear definitions and usage examples of
these two things. I've seen enough of them in scripts to think they
might be useful :) and would hate to miss out on something important...

Thanks,

Chris



------------------------------

Date: Sun, 26 Aug 2001 22:27:22 +0200
From: Tassilo von Parseval <Tassilo.Parseval@post.rwth-aachen.de>
Subject: Re: tut question
Message-Id: <3B895BAA.5080003@post.rwth-aachen.de>

Chris Etzel wrote:

> Hey all,
> 
> I have 'Learning Perl' by Oreilly and it has helped me learn a bunch,
> but unfortunately it is very vague on definition and usage of $_ and @_
> ... any suggestions on getting clear definitions and usage examples of
> these two things. I've seen enough of them in scripts to think they
> might be useful :) and would hate to miss out on something important...

Since you seem to be on a Linux-system, the whole universe of the 
perldocs are lying by your feet.

You'll find a small (but incomplete) bit about $_ when invoking 'perldoc 
perlvar'. As for @_ perlsub will help you.
More about $_ can be found in perlsyn (the paragraphs on 
loop-constructions where $_ is mostly used).

Tassilo

PS: The perldocs are (in parts) surprisingly friendly and easy to 
understand. Difficult to learn Perl from scratch from them but probably 
possible when having a good starter such as 'Learning Perl' is one.

-- 
$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: Sun, 26 Aug 2001 11:19:25 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: warnings with cgi will crash Win32 perl core
Message-Id: <3B893DAD.36A60C24@stomp.stomp.tokyo>

Yves Orton wrote:
 
> Godzilla! wrote:

(snipped)

> > I have been playing around with warnings in the format
> > of -w to discover how many other ways use of warnings
> > screws up a Perl script. They are numerous.
 
> You should post some samples.


Godzilla!
--

For this example, $card_one_url through $card_five_url are declared
as my variables at the beginning of a subroutine and, are immediately
asssigned values long before this block is initiated. These variables
are intended to not be visible outside this sub-routine and, are not
used outside this specific sub-routine, which is nested three levels.

Warnings generates thousands of false messages like this for a variety
of sub-routine enclosed my variables within my script.


1938      $poker_out = "
1939       <BR><BR>
1940       Five Card Draw, Jacks or better to win, nothing wild.<BR>
1941       $in{Ilabika_Hochifo} you have <FONT SIZE=+1> $in{Player_Cash} </FONT> bucks in my gambling bank.<BR>
1942       Five buck ante, five buck bet, ten bucks per poker game.<BR>
1943       Shuffles and deals to $in{Ilabika_Hochifo} these cards: <BR><BR>
1944       <CENTER>
1945       <IMG SRC=\"$card_one_url\">
1946       <IMG SRC=\"$card_two_url\">
1947       <IMG SRC=\"$card_three_url\">
1948       <IMG SRC=\"$card_four_url\">
1949       <IMG SRC=\"$card_five_url\">
1950       </CENTER>";


[Sun Aug 26 10:37:37 2001] chahta.cgi: Variable "$card_one_url" will not stay shared at chahta.cgi line 1938.
[Sun Aug 26 10:37:37 2001] chahta.cgi: Variable "$card_two_url" will not stay shared at chahta.cgi line 1938.
[Sun Aug 26 10:37:37 2001] chahta.cgi: Variable "$card_three_url" will not stay shared at chahta.cgi line 1938.
[Sun Aug 26 10:37:37 2001] chahta.cgi: Variable "$card_four_url" will not stay shared at chahta.cgi line 1938.
[Sun Aug 26 10:37:37 2001] chahta.cgi: Variable "$card_five_url" will not stay shared at chahta.cgi line 1938.


**************


Common server generated environmental variables do not need to
be initialized nor declared.


24  use Socket;
25  $ENV{REMOTE_HOST}  = gethostbyaddr (inet_aton ($ENV{REMOTE_ADDR}), AF_INET);
26  $ENV{REMOTE_HOST} =~ tr/A-Z/a-z/;
27  $ENV{HTTP_USER_AGENT} =~ tr/A-Z/a-z/;


[Sun Aug 26 10:37:37 2001] chahta.cgi: Use of uninitialized value in subroutine entry at chahta.cgi line 25.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in scalar assignment at chahta.cgi line 25.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in scalar assignment at chahta.cgi line 25.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in transliteration (tr///) at chahta.cgi line 26.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in transliteration (tr///) at chahta.cgi line 27.



**************

Warnings displays very clear loopy behavior here and the next two examples.
This looping becomes worse and, generates thousands of lines of warnings
all referring back to valid specific environmental variables.

Without use of Carp to throttle output, this loopy behavior quickly
becomes infinite looping in nature; output from warnings repeats these
types of lines, infinitely.

Two noticable symptoms take place. First is internal linkage to Apache
for this specific script is lost. No further instances can be initiated.
RAM memory is slowly consumed until the process is killed. Other processes
can be run ok, but this process becomes rogue, unaccessable save for a
kill process command.



220    for (@Itihollo)
221     {
222      if (index ($ENV{REMOTE_ADDR}, $_) > -1)
223       { $itikana = "kana"; }
224     }


[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in index at chahta.cgi line 222.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in index at chahta.cgi line 222.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in index at chahta.cgi line 222.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in index at chahta.cgi line 222.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in index at chahta.cgi line 222.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in index at chahta.cgi line 222.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in index at chahta.cgi line 222.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in index at chahta.cgi line 222.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in index at chahta.cgi line 222.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in index at chahta.cgi line 222.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in index at chahta.cgi line 222.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in index at chahta.cgi line 222.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in index at chahta.cgi line 222.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in index at chahta.cgi line 222.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in index at chahta.cgi line 222.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in index at chahta.cgi line 222.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in index at chahta.cgi line 222.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in index at chahta.cgi line 222.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in index at chahta.cgi line 222.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in index at chahta.cgi line 222.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in index at chahta.cgi line 222.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in index at chahta.cgi line 222.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in index at chahta.cgi line 222.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in index at chahta.cgi line 222.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in index at chahta.cgi line 222.

(truncated here)



245    for (@Aiokpulo)
246     {
247      if (substr ($ENV{REMOTE_ADDR}, 0, 10) eq $_)
248       {
249        $okpani = "CHAT BANISHED ATTEMP:";


[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in substr at chahta.cgi line 247.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in substr at chahta.cgi line 247.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in substr at chahta.cgi line 247.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in substr at chahta.cgi line 247.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in substr at chahta.cgi line 247.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in substr at chahta.cgi line 247.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in substr at chahta.cgi line 247.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in substr at chahta.cgi line 247.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in substr at chahta.cgi line 247.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in substr at chahta.cgi line 247.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in substr at chahta.cgi line 247.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in substr at chahta.cgi line 247.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in substr at chahta.cgi line 247.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in substr at chahta.cgi line 247.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in substr at chahta.cgi line 247.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in substr at chahta.cgi line 247.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in substr at chahta.cgi line 247.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in substr at chahta.cgi line 247.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in substr at chahta.cgi line 247.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in substr at chahta.cgi line 247.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in substr at chahta.cgi line 247.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in substr at chahta.cgi line 247.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in substr at chahta.cgi line 247.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in substr at chahta.cgi line 247.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in substr at chahta.cgi line 247.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in substr at chahta.cgi line 247.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in substr at chahta.cgi line 247.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in substr at chahta.cgi line 247.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in substr at chahta.cgi line 247.

(truncated here)




277      for (@bad_proxy_list1)
278       {
279        if (index ($ENV{REMOTE_ADDR}, $_) > -1)
280         { $hochifo_iksho = "ofni"; }
281       }


[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in index at chahta.cgi line 279.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in index at chahta.cgi line 279.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in index at chahta.cgi line 279.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in index at chahta.cgi line 279.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in index at chahta.cgi line 279.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in index at chahta.cgi line 279.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in index at chahta.cgi line 279.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in index at chahta.cgi line 279.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in index at chahta.cgi line 279.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in index at chahta.cgi line 279.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in index at chahta.cgi line 279.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in index at chahta.cgi line 279.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in index at chahta.cgi line 279.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in index at chahta.cgi line 279.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in index at chahta.cgi line 279.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in index at chahta.cgi line 279.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in index at chahta.cgi line 279.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in index at chahta.cgi line 279.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in index at chahta.cgi line 279.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in index at chahta.cgi line 279.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in index at chahta.cgi line 279.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in index at chahta.cgi line 279.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in index at chahta.cgi line 279.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in index at chahta.cgi line 279.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in index at chahta.cgi line 279.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in index at chahta.cgi line 279.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in index at chahta.cgi line 279.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in index at chahta.cgi line 279.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in index at chahta.cgi line 279.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in index at chahta.cgi line 279.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in index at chahta.cgi line 279.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in index at chahta.cgi line 279.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in index at chahta.cgi line 279.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in index at chahta.cgi line 279.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in index at chahta.cgi line 279.
[Sun Aug 26 10:37:38 2001] chahta.cgi: Use of uninitialized value in index at chahta.cgi line 279.



(truncated here)


------------------------------

Date: Sun, 26 Aug 2001 18:46:31 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: Yet another regex question
Message-Id: <3b894406.1127$284@news.op.net>

In article <m1vgjdvtkh.fsf@halfdome.holdit.com>,
Randal L. Schwartz <merlyn@stonehenge.com> wrote:
>This one gets rid of the enclosing whitespace:
>
>  $str = "foo(  a,   b1 b2   , c   )";
>  my @items = split /\s*,\s*/, ($str =~ /\(\s*(.*?)\s*\)/)[0];

I think that [0] is unnecessary there---one might as well let the
match be evaluated in list context.

I only mention this because it's been on my mind a lot lately.
Recently I needed to write something like:

        perl -nle '($d) = /blah(\d+)blah\.jpg/; $n = sprintf "img%03d.jpg", $d; symlink $_ => $n' `find ....`

and I realized partway through that I could write this instead:

        perl -nle '$n = sprintf "img%03d.jpg", /blah(\d+)blah\.jpg/; symlink $_ => $n' `find ....`

At the time it struck me that maybe we don't do this as much as we could.

(Of course, I could have eliminated $n also, but I didn't.)
-- 
@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: 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 1619
***************************************


home help back first fref pref prev next nref lref last post