[23361] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5580 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Sep 28 14:06:13 2003

Date: Sun, 28 Sep 2003 11:05:08 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sun, 28 Sep 2003     Volume: 10 Number: 5580

Today's topics:
        A couple of hash questions <dave.nospam@ntlworld.com>
    Re: add half an hour to all times in file <bwaNOlSPtAMon@rochester.rr.com>
    Re: add half an hour to all times in file <postmaster@castleamber.com.invalid>
    Re: add half an hour to all times in file <noreply@gunnar.cc>
    Re: add half an hour to all times in file <bart.lateur@pandora.be>
    Re: Can I simplify this? <spamfilter@cheiron-it.nl>
        How exactly do I build %INC keys? <scriptyrich@yahoo.co.uk>
        Max Memory in Perl and How to reuse gabage? (Great Deals)
    Re: Max Memory in Perl and How to reuse gabage? <postmaster@castleamber.com.invalid>
    Re: Max Memory in Perl and How to reuse gabage? <jurgenex@hotmail.com>
    Re: MythTV Perl script (Randal L. Schwartz)
    Re: New version - Perl 5.8.1 is out! <pne-news-20030928@newton.digitalspace.net>
    Re: Passing a directory into $ARGV[0] from a shell scri <none@none.com>
    Re: Pattern remembering problem <shemond@hotmail.com>
    Re: Problem viewing Google threads for clpm (& others) (Chris Charley)
    Re: Someone abusing moderator priveledge? (Mark Jason Dominus)
    Re: sort problem <recoverer@lycos.de>
    Re: sort problem <mbudash@sonic.net>
    Re: Splitting subroutines out of a file <FirstName.LastNameWithUnderscoreForSpace@Pandora.Be.RemoveThis>
    Re: Splitting subroutines out of a file <noemail@rochester.rr.com>
    Re: Uploading files using CGI.pm <Juha.Laiho@iki.fi>
    Re: use strict with an undeclared variable <kuujinbo@hotmail.com>
    Re: use strict with an undeclared variable <REMOVEsdnCAPS@comcast.net>
    Re:  <bwalton@rochester.rr.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sun, 28 Sep 2003 17:43:36 +0100 (BST)
From: "Dave Saville" <dave.nospam@ntlworld.com>
Subject: A couple of hash questions
Message-Id: <qnirfnivyyragyjbeyqpbz.hly1oo2.pminews@text.news.ntlworld.com>

If I have a complicated structure, say a hash of hashes/arrays etc and
I want to save it for later I can use store().

If I only have a simple hash, just plain name/value pairs, then is it
more efficient to use store() or a plain text file? Taking into account
reading the thing back in.

If the latter, is there a better way to read it back in, assuming space
separated one pair/line, than:

($name, $value) = split;
$hash{$name} = $value;

TIA

Regards

Dave Saville

NB switch saville for nospam in address




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

Date: Sun, 28 Sep 2003 14:44:59 GMT
From: Bob Walton <bwaNOlSPtAMon@rochester.rr.com>
Subject: Re: add half an hour to all times in file
Message-Id: <3F76F3E9.8040909@rochester.rr.com>

Dan Jacobson wrote:

> [Couldn't reply to Mr. Walton's spam protected address, even after
> decoding. See http://jidanni.org/comp/spam/ ]


Yes, I had to sacrifice my email address to the spam gods (suddenly 
spam-bombed at the rate of 2000/day).  And the new one's not going on 
usenet in *any* form.  I'll be nice and change the addresses to 
something like totally@bogus.com (oh, oops, I see bogus.com is live) so 
folks don't waste their time.  Thanks for mentioning that.


> 
> Bob> use Date::Manip;
> 
> Thanks.  Say, should the Date::Parse perldoc page say 'SEE ALSO
> Date::Parse' on it, or is that unix practice not common perl practice?
> 

That doesn't seem to be common practice, except, of course, amongst a 
family of dependent modules.  Probably because the modules are not 
really a part of a comprehensive whole, but pretty much are standalone 
entities.  And they do somewhat tend to come and go, so keeping "see 
also" lists up-to-date would be a chore (which means they would always 
be out-of-date, and so less than fully useful anyway).  Also, it seems 
there is a bit of "module competition" between authors, so why should 
they include pointers to the competition in their docs?

-- 
Bob Walton



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

Date: Sun, 28 Sep 2003 16:59:01 +0200
From: John Bokma <postmaster@castleamber.com.invalid>
Subject: Re: add half an hour to all times in file
Message-Id: <1064761271.778695@halkan.kabelfoon.nl>

Bob Walton wrote:

> Dan Jacobson wrote:
> 
>> [Couldn't reply to Mr. Walton's spam protected address, even after
>> decoding. See http://jidanni.org/comp/spam/ ]
> 
> Yes, I had to sacrifice my email address to the spam gods (suddenly 
> spam-bombed at the rate of 2000/day).  And the new one's not going on 

That's Swen. I am blocking it at the server at the moment.

> usenet in *any* form.  I'll be nice and change the addresses to 
> something like totally@bogus.com (oh, oops, I see bogus.com is live) so 
> folks don't waste their time.  Thanks for mentioning that.

put .invalid at the end. Don't invent TLDs, or worse domains. Even the 
most silly domain names might come in existence one day. And since 
harvested email addresses end up on CD ROMs and are not checked if valid 
it is quite possible that a new domain ends up with hundreds of spam 
mailes a day thanks to someone "inventing" a domain name.

-- 
Kind regards,                          oh baby
John                                   let me hit you with the clue bat
                                                     since your attitude
http://johnbokma.com/                                   makes me so sad



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

Date: Sun, 28 Sep 2003 17:24:26 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: add half an hour to all times in file
Message-Id: <bl6uno$8n6ob$1@ID-184292.news.uni-berlin.de>

John Bokma wrote:
> Bob Walton wrote:
>> Yes, I had to sacrifice my email address to the spam gods
>> (suddenly spam-bombed at the rate of 2000/day).  And the new
>> one's not going on usenet in *any* form.  I'll be nice and change
>> the addresses to something like totally@bogus.com (oh, oops, I
>> see bogus.com is live) so folks don't waste their time.
> 
> put .invalid at the end. Don't invent TLDs, or worse domains. Even
> the most silly domain names might come in existence one day. And
> since harvested email addresses end up on CD ROMs and are not
> checked if valid it is quite possible that a new domain ends up
> with hundreds of spam mailes a day thanks to someone "inventing" a
> domain name.

A valid point, John. Also, some news services require valid addresses.
My address noreply@gunnar.cc is valid - and it forwards to /dev/null ...

The link in my sig takes you to a contact form, which I have found to
be a convenient way to still being contactable. I wrote a Perl module
for the purpose, btw: http://search.cpan.org/~gunnar/

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl



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

Date: Sun, 28 Sep 2003 15:51:04 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: add half an hour to all times in file
Message-Id: <rl0env07pl3459q9ml4iohqg69c5r5hf71@4ax.com>

Bob Walton wrote:

>Yes, I had to sacrifice my email address to the spam gods (suddenly 
>spam-bombed at the rate of 2000/day). 

The Swen worm. See my little script to delete them from a POP server, by
examinging the start of the message for a MIME subheader for an
executable attachment.

	<http://perlmonks.org/index.pl?node_id=292982>

-- 
	Bart.


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

Date: Sun, 28 Sep 2003 18:02:54 +0200
From: "Frank Maas" <spamfilter@cheiron-it.nl>
Subject: Re: Can I simplify this?
Message-Id: <3f770631$0$3614$e4fe514c@dreader6.news.xs4all.nl>


"Gunnar Hjalmarsson" <noreply@gunnar.cc> schreef in bericht
news:bl5aje$81nlc$1@ID-184292.news.uni-berlin.de...
> Steve Hémond wrote:
> > Is there any way I can simplify this line? :
> >
> >   if ($line =~ /x/ || $line =~ /\b[Tt]he\b/)
>
>      if ($line =~ /x|\b[Tt]he\b/)

But be warned. The 'bible' ('Programming Perl', 3rd ed) says on
page 595 that the || alternative is often faster due to the way
the regex optimizer works. You might want to try it out first...

--Frank




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

Date: Sun, 28 Sep 2003 17:01:34 +0100
From: Rich <scriptyrich@yahoo.co.uk>
Subject: How exactly do I build %INC keys?
Message-Id: <bl70ds$5vf$1@news7.svr.pol.co.uk>

According to camel p.300:

  "The key will be the module filename"

I therefore tried the following to test whether Data::Dumper (for example)
had been used:

  use File::Spec;
  use Data::Dumper;

  my $filename = File::Spec->catfile("Data", "Dumper.pm");

  print $INC{$filename} ? "yes\n" : "no\n";        # Fails on Win32

But although it worked on Linux, it failed on Win32 where the key is
actually the same as under Linux:

  print $INC{"Data/Dumper.pm"} ? "yes\n" : "no\n"; # OK on Win32 and Linux

I know Win32 perl allows '/' as well as '\' directory separators, but now
I'm not sure of the correct way to build %INC keys. Is it:

1) The key is actually the same on all platforms. Ie $INC{"Data/Dumper.pm"}
   will work on all platforms (Mac, VMS etc).

2) The key must use the system directory separator - in that case, since
   File::Spec->catfile didn't work, where is the "correct" system directory
   separator defined? Equally, do I need to be careful with how I handle
   ".pm" extensions?

If the answer is 2), does anyone have tested code they could post here to
handle this?

Many thanks,
-- 
Rich
scriptyrich@yahoo.co.uk


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

Date: 28 Sep 2003 06:28:08 -0700
From: deals@slip-12-64-108-121.mis.prserv.net (Great Deals)
Subject: Max Memory in Perl and How to reuse gabage?
Message-Id: <cafe07c7.0309280528.3610d900@posting.google.com>

If I use 
@lines = <INPUT>
to read a file, to avoid the comlicated method from PerlFaq, what is
the max size of the file @lines = <INPUT> can read? Upto the max of
the physical memory+swep? Will my or local automatically do gabarage
collection/release?

If I use great deals of memory in @ and %, and I really want to
allocate more memory again in the script, should I use undef the @ and
% to release the memory?

Another question is how large can a $ be in term of size. How large an
interger perl can handle. I know there is some limit of the biggest
interger in C, then I will have a long interger in C.


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

Date: Sun, 28 Sep 2003 15:35:02 +0200
From: John Bokma <postmaster@castleamber.com.invalid>
Subject: Re: Max Memory in Perl and How to reuse gabage?
Message-Id: <1064756233.19832@halkan.kabelfoon.nl>

Great Deals wrote:

> If I use 
> @lines = <INPUT>
> to read a file, to avoid the comlicated method from PerlFaq, what is

What complicated method? reading line by line? If you consider that 
complicated then programming is way to complicated for you I guess.

-- 
Kind regards,                          oh baby
John                                   let me hit you with the clue bat
                                                     since your attitude
http://johnbokma.com/                                   makes me so sad



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

Date: Sun, 28 Sep 2003 13:49:14 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Max Memory in Perl and How to reuse gabage?
Message-Id: <uFBdb.23175$ZR1.14953@nwrddc01.gnilink.net>

Great Deals wrote:
> If I use
> @lines = <INPUT>
> to read a file,

In most cases it is not a good idea to store the whole file in memory unless
you cannot process the file line by line. Most applications can process a
file line by line or can easily be rewritten to process a file line by line.

> to avoid the comlicated method from PerlFaq, what is

What complicated method? No idea what you are talking about.

> the max size of the file @lines = <INPUT> can read? Upto the size of
> the physical memory+swep?

The maximum size of a Perl array is limited by the available amount of
virtual memory and maximum index size. Depending on your OS, 32 versus 64
bit, and your version of Perl that should be somewhere in the GB or TB
range.
But please be aware that due to the way Perl represents scalars a string
with 100 characters takes up quite a bit more space than just 100 bytes.

> Will my or local automatically do gabarage
> collection/release?

Collect: yes.
Release to the OS: AFAIK no

[...]

> Another question is how large can a $ be in term of size.

Only limited by your virtual memory and the 32 resp. 64 bit index boundary.

> How large an
> interger perl can handle. I know there is some limit of the biggest
> interger in C, then I will have a long interger in C.

You can always use Math::BigInt

jue




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

Date: Sun, 28 Sep 2003 13:46:49 GMT
From: merlyn@stonehenge.com (Randal L. Schwartz)
To: 4hands@earthlink.net (Dennis)
Subject: Re: MythTV Perl script
Message-Id: <cb8fba4e80824ae45e0a1e2f27da4d03@news.teranews.com>

>>>>> "Dennis" == Dennis  <4hands@earthlink.net> writes:

Dennis> Can anyone tell me why this isn't working. This script is supposed to
Dennis> take this pay per view information off this webpage and put it into a
Dennis> MySQL database. Unfortunately it doesn't do that.

Are you the author?  If not, did you ask the author first?
-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: Sun, 28 Sep 2003 18:15:39 +0200
From: Philip Newton <pne-news-20030928@newton.digitalspace.net>
Subject: Re: New version - Perl 5.8.1 is out!
Message-Id: <o82env8mur6mpe58e93u8er7hg1onn7v26@4ax.com>

On Sat, 27 Sep 2003 11:46:35 -0400, Cyde Weys <cyde@umd.edu> wrote:

> http://developers.slashdot.org/article.pl?sid=03/09/27/1345229&mode=nested&tid=126&tid=145&tid=156&tid=162&tid=164&tid=185&tid=99

Or http://use.perl.org/article.pl?sid=03/09/26/2231256 . Arguably more
Perlish.

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.


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

Date: Sun, 28 Sep 2003 16:35:22 GMT
From: "John" <none@none.com>
Subject: Re: Passing a directory into $ARGV[0] from a shell script
Message-Id: <e5Edb.127800$bo1.81379@news-server.bigpond.net.au>


*snip*

> HTH
>
> -- 
> Jim
>
> Copyright notice: all code written by the author in this post is
>  released under the GPL. http://www.gnu.org/licenses/gpl.txt
> for more information.
>
> a fortune quote ...
> One Page Principle:  A specification that will not fit on one
> page of 8.5x11 inch paper cannot be understood.   -- Mark Ardis

Guys,
It looks like I may have confused some ppl here with a not-too-exhausting
description of what I'm actually trying to accomplish.
Sorry for that. Will try to elaborate:

I have a shell script and I have a Perl script.
Each can be run on its own or they can be run in sequence [shell first].

Now, the key to all of this is a file located is some directory that I'd
like to edit/change/delete/whatever.

I can run the Perl script on its own like this:
$ change.pl /dir/test/august myfile.txt

or the Perl script can be called from within the shell script like this:
    ...
    change . myfile.txt
    ...

The reason for the above . [DOT] is that at this point the shell script has
already descended to the directory holding myfile.txt so as it calls the
Perl script I need to stay in the same directory. So $ARGV[0] needs to be .
here but on the other hand, it can [but does not have to] be a full
directory path if the Perl script is run on its own.

And so, when the two scripts were run in sequence, the Perl script would die
at:
chdir '$ARGV[0]' || die "Cannot chdir to: $!\n";

The minute I removed the || die option, the Perl script would complete. So
my first thoughts were along the lines of:
"Hmmm, it's not accepting chdir '.' as valid and falls over. Why is it so?"

Am I making sense? Sorry once again if this post is no improvement on the
previous ones.
I won't be able to adjust the code till Tuesday so unfortunately there's not
much I can offer in terms of further 'constructive' input till then.

Thanks






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

Date: Sun, 28 Sep 2003 09:53:07 -0400
From: Steve =?ISO-8859-1?Q?H=E9mond?= <shemond@hotmail.com>
Subject: Re: Pattern remembering problem
Message-Id: <gIBdb.965$ab5.21630@news20.bellglobal.com>

Thanks a lot!

Steve


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

Date: 28 Sep 2003 07:34:28 -0700
From: charley@pulsenet.com (Chris Charley)
Subject: Re: Problem viewing Google threads for clpm (& others)
Message-Id: <4f7ed6d.0309280634.5623b3ef@posting.google.com>

Hello

I thought I canceled this post to clpm but somehow it got posted. I
meant to post to Google support only.

Chris


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

Date: Sun, 28 Sep 2003 17:08:04 +0000 (UTC)
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: Someone abusing moderator priveledge?
Message-Id: <bl74hk$p1t$1@plover.com>

In article <3f73e543@nntp0.pdx.net>, Tom <tom@nosleep.net> wrote:
>I answered someone's post in comp.lang.perl.moderated and I followed the
>guidlines.
>However, my post was not posted.

If you'd read the guidelines, you'd know that

        Subject: 5. Will I receive a rejection notice if my submission is rejected?
        ===========================================================================

        Absolutely.  Always.  Without fail.  Yes.  In case this isn't clear:

            POSTS ARE NEVER REJECTED SILENTLY.

        If your post hasn't shown up in the newsgroup and you haven't received
        a rejection notice within a day or two of posting, it is almost certain
        that the moderation panel has not received your submission. 


You'd also know this:

        If you would like to verify that your post is, in fact, in the
        hands of the moderation panel, contact the panel administrator
        at

            <mjd-clpm-admin@plover.com>


>I think one of the local cops in this group might be overstepping his
>boundaries and not posting my posts because of disagreements here.

I think you're being paranoid.  I also think you should have made some
effort to find out the true state of affairs before slandering a bunch
of strangers.  

>I might be wrong, but I'm going to find out.

Next time, maybe you should try finding out *before* you make public
accusations.   Completely aside from the benefit of not offending
innocent people, which you may or may not recognize, it would also
benefit you personally to do this, because you would be less likely to
make an ass of yourself, as you did here.

For the record, no article from tom@nosleep.net has ever been
submitted to the moderation panel for comp.lang.perl.moderated.  As
the guidelines say, articles can be mailed to
mjd-clpm-submit@plover.com if the usual news posting path isn't
working for you.



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

Date: Sun, 28 Sep 2003 17:21:18 +0200
From: hugo leitmeier <recoverer@lycos.de>
Subject: Re: sort problem
Message-Id: <3f76fc6f$1@olaf.komtel.net>

Hi Greg,

thank you very much for your help.

best regards

hugo



Greg Bacon schrieb:
> In article <3f76bfcc@olaf.komtel.net>,
>     hugo leitmeier  <recoverer@lycos.de> wrote:
> 
> : [...]
> : I like that. But, how can i accomplish that?
> : 
> : Date		Name	Average	Number
> : ----		----	-------	------
> : 15.08.2003	Anton	10.34	276
> : 27.08.2003	Anton	12.00	2765
> : 29.08.2003	Anton	11.25	2766
> : 10.08.2003	Berta	15.38	138
> : 10.08.2003	Caesar	10.00	374
> : 12.08.2003	Caesar	15.75	3748
> : 21.09.2003	Caesar	17.75	3748
> : ----------	------	-----	----
> : 3rd (asc)	1st(asc)	2nd(asc)
> 
>     % cat try
>     #! /usr/local/bin/perl
> 
>     use warnings;
>     use strict;
> 
>     my @header;
>     my @rows;
> 
>     while (<DATA>) {
>         if (1 .. /^----/) {
>             push @header => $_;
>         }
>         else {
>             push @rows => $_;
>         }
>     }
> 
>     print @header,
>           map $_->[0],
>           sort {
>               $a->[2] cmp $b->[2] ||
>               $a->[3] <=> $b->[3] ||
>               $a->[1] cmp $b->[1]
>           }
>           map [$_, (split)[0,1,3]],
>           @rows;
> 
>     __DATA__
>     Date            Name    Average Number
>     ----            ----    ------- ------
>     21.09.2003      Caesar  17.75   3748
>     15.08.2003      Anton   10.34   276
>     10.08.2003      Berta   15.38   138
>     27.08.2003      Anton   12.00   2765
>     29.08.2003      Anton   11.25   2766
>     10.08.2003      Caesar  10.00   374
>     12.08.2003      Caesar  15.75   3748
>     % ./try
>     Date            Name    Average Number
>     ----            ----    ------- ------
>     15.08.2003      Anton   10.34   276
>     27.08.2003      Anton   12.00   2765
>     29.08.2003      Anton   11.25   2766
>     10.08.2003      Berta   15.38   138
>     10.08.2003      Caesar  10.00   374
>     12.08.2003      Caesar  15.75   3748
>     21.09.2003      Caesar  17.75   3748
> 
> Hope this helps,
> Greg




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

Date: Sun, 28 Sep 2003 17:11:52 GMT
From: Michael Budash <mbudash@sonic.net>
Subject: Re: sort problem
Message-Id: <mbudash-AEF2B3.10115428092003@typhoon.sonic.net>

In article <vndi8ubo1fjg05@corp.supernews.com>,
 gbacon@hiwaay.net (Greg Bacon) wrote:

> In article <3f76bfcc@olaf.komtel.net>,
>     hugo leitmeier  <recoverer@lycos.de> wrote:
> 
> : [...]
> : I like that. But, how can i accomplish that?
> : 
> : Date		Name	Average	Number
> : ----		----	-------	------
> : 15.08.2003	Anton	10.34	276
> : 27.08.2003	Anton	12.00	2765
> : 29.08.2003	Anton	11.25	2766
> : 10.08.2003	Berta	15.38	138
> : 10.08.2003	Caesar	10.00	374
> : 12.08.2003	Caesar	15.75	3748
> : 21.09.2003	Caesar	17.75	3748
> : ----------	------	-----	----
> : 3rd (asc)	1st(asc)	2nd(asc)
> 
>     % cat try
>     #! /usr/local/bin/perl
> 
>     use warnings;
>     use strict;
> 
>     my @header;
>     my @rows;
> 
>     while (<DATA>) {
>         if (1 .. /^----/) {
>             push @header => $_;
>         }
>         else {
>             push @rows => $_;
>         }
>     }
> 
>     print @header,
>           map $_->[0],
>           sort {
>               $a->[2] cmp $b->[2] ||
>               $a->[3] <=> $b->[3] ||
>               $a->[1] cmp $b->[1]
>           }
>           map [$_, (split)[0,1,3]],
>           @rows;
> 
>     __DATA__
>     Date            Name    Average Number
>     ----            ----    ------- ------
>     21.09.2003      Caesar  17.75   3748
>     15.08.2003      Anton   10.34   276
>     10.08.2003      Berta   15.38   138
>     27.08.2003      Anton   12.00   2765
>     29.08.2003      Anton   11.25   2766
>     10.08.2003      Caesar  10.00   374
>     12.08.2003      Caesar  15.75   3748
>
>     % ./try
>     Date            Name    Average Number
>     ----            ----    ------- ------
>     15.08.2003      Anton   10.34   276
>     27.08.2003      Anton   12.00   2765
>     29.08.2003      Anton   11.25   2766
>     10.08.2003      Berta   15.38   138
>     10.08.2003      Caesar  10.00   374
>     12.08.2003      Caesar  15.75   3748
>     21.09.2003      Caesar  17.75   3748
> 
> Hope this helps,
> Greg

close, but col one is not sorting by date, which i assume the o.p. 
wanted. it just looks like it is. you can see this if you change the 
date on the last record thusly:

__DATA__
Date            Name    Average Number
----            ----    ------- ------
21.09.2003      Caesar  17.75   3748
15.08.2003      Anton   10.34   276
10.08.2003      Berta   15.38   138
27.08.2003      Anton   12.00   2765
29.08.2003      Anton   11.25   2766
10.08.2003      Caesar  10.00   374
12.10.2003      Caesar  15.75   3748

your results:

Date            Name    Average Number
----            ----    ------- ------
15.08.2003      Anton   10.34   276
27.08.2003      Anton   12.00   2765
29.08.2003      Anton   11.25   2766
10.08.2003      Berta   15.38   138
10.08.2003      Caesar  10.00   374
12.10.2003      Caesar  15.75   3748
21.09.2003      Caesar  17.75   3748

a slight change to your pre-sort map will fix this. additionally, i 
rearranged the order of that map to make it (i think) easier to see what 
the sort is doing:

print @header,
      map $_->[0],
      sort {
          $a->[1] cmp $b->[1] ||       
          $a->[2] <=> $b->[2] ||         
          $a->[3] <=> $b->[3] ||       
          $a->[4] <=> $b->[4] ||     
          $a->[5] <=> $b->[5]        
      }
      map [
           $_,                                # the whole record  
           (split)[1,3],                      # Name, Number  
           (split (/\./, (split)[0]))[2,1,0]  # Date yyyy, mm, dd  
          ],
      @rows;

hth-

-- 
Michael Budash


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

Date: Sun, 28 Sep 2003 13:10:54 GMT
From: Jos De Laender <FirstName.LastNameWithUnderscoreForSpace@Pandora.Be.RemoveThis>
Subject: Re: Splitting subroutines out of a file
Message-Id: <y5Bdb.45542$O73.1889385@phobos.telenet-ops.be>

James E Keenan wrote:

> <big snip pointing to a misunderstanding>

Probably I didn't explain well enough.
I inherited a bunch of .pl files. Probably containing a number of times the 
same subroutine into the pl file.
Before cleaning up I want to "copy out" all those subroutines in order to 
do some comparing on them based on diff.
In a next step I collect them in a module where they can be maintained then 
consistently.
The help I'm looking for is for the first step.

-- 
Jos De Laender


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

Date: Sun, 28 Sep 2003 15:44:54 GMT
From: Bob Walton <noemail@rochester.rr.com>
Subject: Re: Splitting subroutines out of a file
Message-Id: <3F7701F3.3070905@rochester.rr.com>

Jos De Laender wrote:

> James E Keenan wrote:
> 
> 
>><big snip pointing to a misunderstanding>
>>
> 
> Probably I didn't explain well enough.
> I inherited a bunch of .pl files. Probably containing a number of times the 
> same subroutine into the pl file.
> Before cleaning up I want to "copy out" all those subroutines in order to 
> do some comparing on them based on diff.
> In a next step I collect them in a module where they can be maintained then 
> consistently.
> The help I'm looking for is for the first step.
> 
> 

So if I understand you correctly, you want to parse your .pl files to 
separate out individual sub's into individual files.  So you need a 
parser that will parse Perl source code.  I'm not aware of any, but you 
might try looking on CPAN.  The "B" series of modules might have 
something, but it doesn't look like it at first glance.  B::Xref looks 
like its output could be used to generate a list of sub names and line 
numbers without much trouble, which could perhaps then be used to do the 
job.

My approach would be to manually examine the source in an editor and 
insert a special flag between subs (something like a line consisting of:

#~~sub~~

-- anything that won't otherwise appear in the code.  Then process the 
file with that as the input record separator.  You will have to decide 
how to name the files, since there might be duplicate sub names between 
files and perhaps between packages in one file (and perhaps anonymous 
subs too?) -- use a sequence number?

But all in all, I don't grok what doing all that would buy you over 
simply manipulating the code into the files you want using an editor -- 
it looks like that's what you're going to end up doing anyway.

-- 
Bob Walton



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

Date: Sun, 28 Sep 2003 15:07:00 GMT
From: Juha Laiho <Juha.Laiho@iki.fi>
Subject: Re: Uploading files using CGI.pm
Message-Id: <bl6te0$jq5$1@ichaos.ichaos-int>

"D Borland" <notavailable@nospamplease.com> said:
>Can anyone see why this is not working, when i use the script on my web
>hosting service, it returns success but no image has been uploaded when i
>look in the uploads dir, just can't see why it's not working...

>#!/usr/bin/perl
 ...
>my $uploadDir = 'uploads';
 ...
>open (NEWFILE), ">$uploadDir/$filename"
>  or die "Cannot open $uploadDir/$filename : $!\n";


This at least could be a source of confusion.

When running a program as CGI, there's no guarantee what would be
the working directory of the program when it is run -- and the
$uploadDir is considered to be relative to that unknown directory.

So, change the 'uploads' to some full path to a directory, such as
'/your/web/dir/uploads'.

Other than that, I couldn't find anything strange in the program;
you could help yourself by printing out some debug information
to the browser as the CGI makes progress. So, print the header
right in the start of the program, then at various points print
out values of variables, or just status information from which
you know which parts of your program are being run.

I also suggest that you turn on warnings and strict -- even
though your code seems clean enough.
-- 
Wolf  a.k.a.  Juha Laiho     Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
         PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)


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

Date: Sun, 28 Sep 2003 21:53:08 +0900
From: ko <kuujinbo@hotmail.com>
Subject: Re: use strict with an undeclared variable
Message-Id: <bl6lms$hse$1@pin3.tky.plala.or.jp>

Greg Bacon wrote:

> In article <bl6ge0$bra$1@pin3.tky.plala.or.jp>,
>     ko  <kuujinbo@hotmail.com> wrote:
> 
> : [...]
> :
> : 1. If you're including the strict and warnings pragmas, why is it that 
> : you can get away with not declaring $a? [...]
> 
> The strict pragma's manpage says
> 
>     Because of their special use by sort(), the variables
>     $a and $b are exempted from this check.

Sorry, I must be missing something obvious. I don't see where sort() is 
being called. I thought that a strict comparison is being done and the 
whole point was to avoid using sort.

> : 2. Is defined() necessary in the condition? The assignment of each key 
> : to $a returns true. [...]
> 
> What if the hash contains a 0 key?
> 
> : [...]

That I understand - thanks!



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

Date: Sun, 28 Sep 2003 08:29:24 -0500
From: "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
Subject: Re: use strict with an undeclared variable
Message-Id: <Xns94046084E4DF0sdn.comcast@206.127.4.25>

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1

ko <kuujinbo@hotmail.com> wrote in
news:bl6lms$hse$1@pin3.tky.plala.or.jp: 

> Greg Bacon wrote:
> 
>> In article <bl6ge0$bra$1@pin3.tky.plala.or.jp>,
>>     ko  <kuujinbo@hotmail.com> wrote:
>> 
>> : [...]
>> :
>> : 1. If you're including the strict and warnings pragmas, why is it
>> : that you can get away with not declaring $a? [...]
>> 
>> The strict pragma's manpage says
>> 
>>     Because of their special use by sort(), the variables
>>     $a and $b are exempted from this check.
> 
> Sorry, I must be missing something obvious. I don't see where sort()
> is being called. I thought that a strict comparison is being done and
> the whole point was to avoid using sort.

Because there exists such a thing as 'sort' (and because of how 'sort' 
works in Perl), the variables $a and $b are exempted from this check.

- -- 
Eric
$_ = reverse sort $ /. r , qw p ekca lre uJ reh
ts p , map $ _. $ " , qw e p h tona e and print

-----BEGIN xxx SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>

iQA/AwUBP3biK2PeouIeTNHoEQLCQwCdHqBTYZZdZpm7zy8Tks+Hf+D+DNcAoIS7
xD2FjHrq1mSEBazqj12jkBv2
=fG0i
-----END PGP SIGNATURE-----


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

Date: Sat, 19 Jul 2003 01:59:56 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: 
Message-Id: <3F18A600.3040306@rochester.rr.com>

Ron wrote:

> Tried this code get a server 500 error.
> 
> Anyone know what's wrong with it?
> 
> if $DayName eq "Select a Day" or $RouteName eq "Select A Route") {

(---^


>     dienice("Please use the back button on your browser to fill out the Day
> & Route fields.");
> }
 ...
> Ron

 ...
-- 
Bob Walton



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

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 5580
***************************************


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