[17310] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4732 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Oct 26 11:10:29 2000

Date: Thu, 26 Oct 2000 08:10:16 -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: <972573016-v9-i4732@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 26 Oct 2000     Volume: 9 Number: 4732

Today's topics:
    Re: How can I word wrap on STDOUT? (Tom Christiansen)
    Re: How can I word wrap on STDOUT? (Tad McClellan)
    Re: How can I word wrap on STDOUT? (Tom Christiansen)
    Re: How can I word wrap on STDOUT? <mjcarman@home.com>
    Re: How can I word wrap on STDOUT? (Tom Christiansen)
    Re: How to tell if a directory is empty (Linux). (Marko R. Riedel)
        indirect sub call with strict grey_owl7@my-deja.com
        jpeg image manipulation ejehoel@my-deja.com
    Re: jpeg image manipulation <godzilla@stomp.stomp.tokyo>
    Re: jpeg image manipulation (Bernard El-Hagin)
        log in on a UNIX machine <l.hagen@HumanInference.com>
    Re: Malformed header resulting from use of mkdir() <dsimonis@fiderus.com>
    Re: Malformed header resulting from use of mkdir() <ren.maddox@tivoli.com>
    Re: Malformed header resulting from use of mkdir() <secursrver@hotmail.com>
    Re: Perl on NT <fe8x025@public.uni-hamburg.de>
    Re: Perl on NT <fe8x025@public.uni-hamburg.de>
    Re: Perl on NT <fe8x025@public.uni-hamburg.de>
    Re: renaming local() <iltzu@sci.invalid>
    Re: socket hang <tommylebrun@yahoo.com>
    Re: Sorting is too slow for finding top N keys... - UPD (Marko R. Riedel)
        String Comparison <m_mcwhorter@prairiegroup.com>
    Re: two dimensional arrays <ren.maddox@tivoli.com>
        What is the point of the new keyword 'our'? <bollinge@wholefamily.com>
    Re: What is the point of the new keyword 'our'? <johnroth@ameritech.net>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 26 Oct 2000 07:58:09 -0700
From: tchrist@perl.com (Tom Christiansen)
Subject: Re: How can I word wrap on STDOUT?
Message-Id: <39f83871@cs.colorado.edu>

In article <8t99qd$1ea8$1@msunews.cl.msu.edu>, Eric <eric.kort@vai.org> wrote:
>I have a Perl program that reads a BibTex bibliography and returns the
>abstracts and reference keys matching search criteria I specify at the
>prompt.  However, when it prints the abstract(s) to the screen, I wish it
>would word wrap rather than just wrap at the terminal boundary (makes it a
>little distracting to read).
>
>I could split the abstract into words and print the abstract to stdout word
>by word, keeping track of the line length as I go.  But is their a less
>labor intensive way?

Sure.  Learn formats.  Here's an example I posted yesterday.

--tom

# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	sig-poohba
#
echo x - sig-poohba
sed 's/^X//' >sig-poohba << 'END-of-sig-poohba'
X#!/usr/bin/perl
Xuse 5.006;
Xuse warnings;
Xuse strict;
X
Xconfig();
Xmy $quip = getsig();
Xwritesig($quip);
Xexit;
X
X################################
X
Xsub config {
X    # you should not use a hardcoded directory!
X    my $home =    $ENV{HOME}
X               || $ENV{LOGDIR}
X               || (getpwuid($<))[7]
X               || "/home/p/poohba";
X
X    die "no home: $home" unless -d $home;
X
X    # also, better to use @ARGV than hardcoding a name
X    our $quotefile = @ARGV ? $ARGV[0] : "$home/rap.quote";
X
X    die "no quotefile $quotefile" unless -f $quotefile;
X
X}
X
Xsub getsig {
X    my  $sigfh;
X    our $quotefile;
X
X    open($sigfh, "<", $quotefile)
X        || die "cannot open $quotefile for reading: $!";
X
X##### Uncomment next line to effect standard fortune format processing
X    # local $/ = "\n%%\n";
X
X    # Fetch random line from textfile using constant space
X    # Semi-(proof by induction) of this available in Perl Cookbook
X    my $sigline;
X    local $_;
X    while (<$sigfh>) {
X        $sigline = $_ if rand($.) < 1;
X    }
X
X    close($sigfh)
X        || die "cannot close $quotefile: $!";
X
X    chomp($sigline);  # honors $/, which makes std fortune fmt cool
X
X    return $sigline;
X}
X
Xsub writesig {
X    my ($quote, $author) = split(/\s*:\s*/, $_[0]);
X    $author = "--" . ($author || "Anonymous");
X
X    for ($quote ||= "This signature intentionally left blank.") {
X        1 while s/\t+/' ' x (length($&)*8 - length($`)%8)/e;  # detab
X    }
X
X    # Wrap quote at up to *but not exceeding* three lines, because we
X    # need to leave one for the attribution, and Thou Shalt Not Exceed
X    # Four Lines Of Signature.  Format each such line with a 4-space
X    # indent, plus up to 72 characters following it, wrapping at word
X    # boundaries and hyphens.  Then add right-justified author
X    # attribution on line following.
X
Xformat sigformat =
X    ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
X$quote
X   ~^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
X$quote
X   ~^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
X$quote
X                                                @>>>>>>>>>>>>>>>>>>>>>>>>>>
X$author
X.
X
X    local $~ = 'sigformat';
X    write;
X
X}
X
END-of-sig-poohba
exit



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

Date: Thu, 26 Oct 2000 08:46:25 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: How can I word wrap on STDOUT?
Message-Id: <slrn8vg9t1.f69.tadmc@magna.metronet.com>

On Thu, 26 Oct 2000 09:01:21 -0400, Eric <eric.kort@vai.org> wrote:

>I wish it
>would word wrap


Then you should get a module that does word wrapping.

Modules can be gotten from CPAN.


>But is their a less
>labor intensive way?


The name of one already-invented-wheel that does that is Text::Wrap.


-- 
    Tad McClellan                          SGML consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: 26 Oct 2000 08:21:44 -0700
From: tchrist@perl.com (Tom Christiansen)
Subject: Re: How can I word wrap on STDOUT?
Message-Id: <39f83df8@cs.colorado.edu>

In article <slrn8vg9t1.f69.tadmc@magna.metronet.com>,
Tad McClellan <tadmc@metronet.com> wrote:
>On Thu, 26 Oct 2000 09:01:21 -0400, Eric <eric.kort@vai.org> wrote:
>
>>I wish it
>>would word wrap
>
>Then you should get a module that does word wrapping.

Disagree.

Generally, this is overkill, as I demonstrated in my other posting.
Perl has formats, and always has had.  The ^<< formats are generally
sufficient for wrapping.   If the daemon hadn't eaten my homework
yesterday, you would have seen a brief wrap on gratuitously turning
to abstruse and obfuscatory modules instead of using simple built-ins.

>The name of one already-invented-wheel that does that is Text::Wrap.

Specifically, that module, which is standard, is replete with various
annoyances--and even more so if you're thinking of something that
emulated fmt(1),

--tom


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

Date: Thu, 26 Oct 2000 08:57:31 -0500
From: Michael Carman <mjcarman@home.com>
Subject: Re: How can I word wrap on STDOUT?
Message-Id: <39F8384B.5172958D@home.com>

Eric wrote:
> 
> [W]hen it prints the abstract(s) to the screen, I wish it
> would word wrap rather than just wrap at the terminal boundary

The Text::Wrap module will do this for you.

-mjc


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

Date: 26 Oct 2000 09:03:26 -0700
From: tchrist@perl.com (Tom Christiansen)
Subject: Re: How can I word wrap on STDOUT?
Message-Id: <39f847be@cs.colorado.edu>

In article <39F8384B.5172958D@home.com>,
Michael Carman  <mjcarman@home.com> wrote:
>Eric wrote:
>> 
>> [W]hen it prints the abstract(s) to the screen, I wish it
>> would word wrap rather than just wrap at the terminal boundary
>
>The Text::Wrap module will do this for you.

What, doesn't anyone know regular Perl anymore? :-(

--tom


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

Date: 26 Oct 2000 15:01:18 +0200
From: mriedel@neuearbeit.de (Marko R. Riedel)
Subject: Re: How to tell if a directory is empty (Linux).
Message-Id: <lzzojrwych.fsf@linuxsexi.neuearbeit.de>


Greetings.

Thanks to all who replied. I was indeed concerned that the directory
handle should be properly closed when the procedure returns. That's
why I used the 'last' statement in the while loop. I did not know
about handles being automatically closed when they go out of scope. I
did not use a construct like

$is_empty = (2 == () = readdir(DH));

because I was worried that this would read thousands of directory
entries when run e.g. on a news spool directory.

Regards,

Marko



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

Date: Thu, 26 Oct 2000 14:26:56 GMT
From: grey_owl7@my-deja.com
Subject: indirect sub call with strict
Message-Id: <8t9ev7$go7$1@nnrp1.deja.com>

What's wrong with the following? How can I call a subroutine using a variable
when I use strict?  I'm using Perl version 5.004_04.

ty
Viktor

P.S. Please reply to email address.

#!/usr/bin/perl5 -w

use strict;

sub Bingo() {print "It's Bingo!\n"}
sub Bongo() {print "No, it's Bongo!\n"}
my $beg = "Bi";
my $full = $beg."ngo";
&$full();
print "1 $full\n";

$beg = "Bo";
$full = ($beg).("ngo");
print "2 $full\n";

&{$full};
print "\n";


__END__

Results without "use strict;":
	It's Bingo!
	1 Bingo
	2 Bongo
	No, it's Bongo!

Results with "use strict;":
	Can't use string ("Bingo") as a subroutine ref while "strict refs" in use at
 ./test_subcall.pl line 9.


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Thu, 26 Oct 2000 13:18:21 GMT
From: ejehoel@my-deja.com
Subject: jpeg image manipulation
Message-Id: <8t9aum$d3n$1@nnrp1.deja.com>

I'd like to manipulate (jpeg) images using perl. For example to
generate thumbnails of large images or to increase the
compression ratio.
Thanx


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Thu, 26 Oct 2000 06:36:41 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: jpeg image manipulation
Message-Id: <39F83369.8667B0D4@stomp.stomp.tokyo>

ejehoel@my-deja.com wrote:
 
> I'd like to manipulate (jpeg) images using perl. For 
> example to generate thumbnails of large images or to
> increase the compression ratio.


You have my permission to do this.

Godzilla!


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

Date: 26 Oct 2000 13:36:29 GMT
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: jpeg image manipulation
Message-Id: <slrn8vgcu1.28m.bernard.el-hagin@gdndev25.lido-tech>

On Thu, 26 Oct 2000 13:18:21 GMT, ejehoel@my-deja.com
<ejehoel@my-deja.com> wrote:
>I'd like to manipulate (jpeg) images using perl. For example to
>generate thumbnails of large images or to increase the
>compression ratio.

Wow, that's great. Keep us posted.

>Thanx

No biggie.

Cheers,
Bernard
--
perl -le'
($B,$e,$r,$n,$a,$r,$d)=q=$B$e$r$n$a$r$d==~m;
\$(.);xg;print$B.$e.$r.$n.$a.$r.$d;'


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

Date: Thu, 26 Oct 2000 15:38:41 +0200
From: Lex Hagen <l.hagen@HumanInference.com>
Subject: log in on a UNIX machine
Message-Id: <04932F2B7E20D211856C00A0C9A06095286434@mail.humaninference.com>

Does anyone know how to log-in on a UNIX machine from a WinNT machine
using PERL? So connecting, logging in (giving username, p.w.).

I would like to eventuelly do this from Visual Basic, does anyone know
if that is possible also?

thanx in advance,
Lex



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

Date: Thu, 26 Oct 2000 09:18:46 -0400
From: Drew Simonis <dsimonis@fiderus.com>
Subject: Re: Malformed header resulting from use of mkdir()
Message-Id: <39F82F36.4852F1D2@fiderus.com>

Ed Grosvenor wrote:
> 
> As a result I get an error saying:
> Malformed header from script.  Bad header=mkdir() 1

If you would have spent 3 minutes reading _any_ cgi FAQ you would
have seen the answer.

> 
> The same thing happens with chdir().  The strange thing is that the script
> actually works.  The directory is created and the file that is to be created
> later in the script is created within that directory.  Unfortunately, I get
> this error.  What I'm wondering is if there is any way to get Perl (or
> Apache...or Windows...whichever entity has such a problem with this funtion)
> to ignore the malformed header.

Your solution is not the correct one.  Why not supply a valid header
instead of trying to trick things?

> 
> So you know, this is a CGI script called from a Web form.  The script is
> supposed to then perform this action (create a directory and a file within
> it) and then generate the HTML form that will allow the user to edit the
> file within the new directory.

So you know, folks who like to play with CGI scripting hang out in
comp.infosystems.www.authoring.cgi

> 
> The script works other than the error.  My debugger doesn't catch anything
> on it and I could swear I'm doing everything right.  If anyone has any
> ideas, please, please let me know.  I would appreciate it.  Have a great
> day!

The above is a fine indicator that the problem is not related to Perl,
and is therefore off topic here.


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

Date: 25 Oct 2000 23:24:27 -0500
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: Malformed header resulting from use of mkdir()
Message-Id: <m38zrcs004.fsf@dhcp11-177.support.tivoli.com>

"Ed Grosvenor" <secursrver@hotmail.com> writes:

> Hi.  I'm having a little problem with mkdir in Apache on Windoze 98.  Yeah,
> I know, but I share this computer with my brother and he didn't like
> Slackware very much.  Anyway, here's what I'm doing:
> 
> $dir  is dynamically assigned based on user input.
> 
> print("mkdir() ", mkdir("$dir", 0777), "\n");
> 
> As a result I get an error saying:
> Malformed header from script.  Bad header=mkdir() 1

Looks like you have the above print statement executing before the
real header is output.

-- 
Ren Maddox
ren@tivoli.com


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

Date: Thu, 26 Oct 2000 14:46:52 GMT
From: "Ed Grosvenor" <secursrver@hotmail.com>
Subject: Re: Malformed header resulting from use of mkdir()
Message-Id: <wtXJ5.26178$rD3.1781464@newsread2.prod.itd.earthlink.net>

To those of you who were helpful, I want to say thank you.  To those of you
who were simply rude and condescending, all I can say is that I hope that
someone shows you the same courtesy some day when you run accross your next
pedestrian stumbling block.  Of course, good programmers understand that
sometimes when the pressure is on and the hours are long, it's the obvious
answer that escapes us.  I just hope that those of you who find it more
fulfilling to criticize someone for asking a question than to play a
meaningful part in a mutulally beneficial discussion with other programmers
never have "one of those days."  Again, thank you to those who were so
helpful.


Drew Simonis <dsimonis@fiderus.com> wrote in message
news:39F82F36.4852F1D2@fiderus.com...
> Ed Grosvenor wrote:
> >
> > As a result I get an error saying:
> > Malformed header from script.  Bad header=mkdir() 1
>
> If you would have spent 3 minutes reading _any_ cgi FAQ you would
> have seen the answer.
>
> >
> > The same thing happens with chdir().  The strange thing is that the
script
> > actually works.  The directory is created and the file that is to be
created
> > later in the script is created within that directory.  Unfortunately, I
get
> > this error.  What I'm wondering is if there is any way to get Perl (or
> > Apache...or Windows...whichever entity has such a problem with this
funtion)
> > to ignore the malformed header.
>
> Your solution is not the correct one.  Why not supply a valid header
> instead of trying to trick things?
>
> >
> > So you know, this is a CGI script called from a Web form.  The script is
> > supposed to then perform this action (create a directory and a file
within
> > it) and then generate the HTML form that will allow the user to edit the
> > file within the new directory.
>
> So you know, folks who like to play with CGI scripting hang out in
> comp.infosystems.www.authoring.cgi
>
> >
> > The script works other than the error.  My debugger doesn't catch
anything
> > on it and I could swear I'm doing everything right.  If anyone has any
> > ideas, please, please let me know.  I would appreciate it.  Have a great
> > day!
>
> The above is a fine indicator that the problem is not related to Perl,
> and is therefore off topic here.
>




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

Date: Thu, 26 Oct 2000 16:11:17 +0200
From: Alex Fitterling <fe8x025@public.uni-hamburg.de>
Subject: Re: Perl on NT
Message-Id: <52e9t8.3r.ln@sokrates2.hagenbeck.uni-hamburg.de>

Daniel van den Oord <danielxx@bart.nl> wrote:
> LOL haha a microsoft Perl Version OMG.. that's just like www.mslinux.org
> Sorry just made me smile when I read it !!!
Heck.. if I understood you right - this is just another peace of
Billschr**ts Dreamfactory...??? Hell. I can't believe... 




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

Date: Thu, 26 Oct 2000 16:12:36 +0200
From: Alex Fitterling <fe8x025@public.uni-hamburg.de>
Subject: Re: Perl on NT
Message-Id: <k4e9t8.3r.ln@sokrates2.hagenbeck.uni-hamburg.de>

Josef Moellers <josef.moellers@fujitsu-siemens.com> wrote:
> Daniel van den Oord wrote:
>> 
>> LOL haha a microsoft Perl Version OMG.. that's just like www.mslinux.org
>> Sorry just made me smile when I read it !!!

>> > Alex Fitterling <fe8x025@public.uni-hamburg.de> wrote:
>> > > Hello.
>> > >
>> > > Is Perl in NT (4.0) integrated, or has it to be installed additionally
>> > > ?

> Why not, afaic, MS should be forced to integrate everything, from Office

NT should be forced to be kicked out ! sorry.. but most people
understand... but anyhow, in your terms I do not disagree :)


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

Date: Thu, 26 Oct 2000 16:12:58 +0200
From: Alex Fitterling <fe8x025@public.uni-hamburg.de>
Subject: Re: Perl on NT
Message-Id: <a5e9t8.3r.ln@sokrates2.hagenbeck.uni-hamburg.de>

Arthur Dalessandro <adalessandro@odione.com> wrote:
 Thanx
Alex



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

Date: 26 Oct 2000 14:27:31 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: renaming local()
Message-Id: <972569806.27386@itz.pp.sci.fi>

In article <8FD892B8Bdarkononenet@206.112.192.118>, David Wall wrote:
>
>So 'this' is out, my and our are already in use.  I'd bet 'private' has 
>other meanings in other languages as well, besides being misleading.  I 
>don't like 'temporary' because it's too long.  Larry Wall suggested 
>'meanwhile', which has a nice sound, but I think it's too long, too.

I like both 'temporary' and 'meanwhile', and I don't think the length
is a problem.  The way I see it, sesquipedalian keywords are perfectly
appropriate for features that should only be used sparingly anyway.

-- 
Ilmari Karonen - http://www.sci.fi/~iltzu/
Please ignore Godzilla  | "By promoting postconditions to
and its pseudonyms -    |  preconditions, algorithms become
do not feed the troll.  |  remarkably simple."  -- Abigail


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

Date: Thu, 26 Oct 2000 14:50:01 GMT
From: T <tommylebrun@yahoo.com>
Subject: Re: socket hang
Message-Id: <8t9gal$ht0$1@nnrp1.deja.com>

In article <x74s20mes8.fsf@home.sysarch.com>,
  Uri Guttman <uri@sysarch.com> wrote:
> >>>>> "T" == T  <tommylebrun@yahoo.com> writes:
>
>   T> Has anyone had problems with socket hangs? Specifically, I send
data to
>   T> a server & wait forever for a reply. Is there a way to time it
>   T> out?        T.
>
> jeez, the third socket buffering problem today. turn on autoflushing
on
> the socket and use non-blocking reads.
>
> uri
>
> --
> Uri Guttman  ---------  uri@sysarch.com  ----------
http://www.sysarch.com
> SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX
Consulting
> The Perl Books Page  -----------  http://www.sysarch.com/cgi-
bin/perl_books
> The Best Search Engine on the Net  ----------
http://www.northernlight.com
>

I am autoflushing the socket & I am using sysread to get back the data.
Here is what I am experiencing. My script sends data to a server &
waits for acknowledgement data to come back. The records are sent fine.
The problem occurs when the data is sent back. I get a few bytes & then
it seems like the server stops sending. At that point my program is
still waiting for the rest of the record. And it waits,,,, forever....


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 26 Oct 2000 15:28:39 +0200
From: mriedel@neuearbeit.de (Marko R. Riedel)
Subject: Re: Sorting is too slow for finding top N keys... - UPDATE: Clarification.
Message-Id: <lzy9zbwx2w.fsf@linuxsexi.neuearbeit.de>

mriedel@neuearbeit.de (Marko R. Riedel) writes:

> Greetings.
> 
> There was a thread in this group about a year and a half ago where the
> use of sorting algorithms to extract order statistics was discussed. I
> presented several implementations of the QuickSelect algorithm. I
> didn't properly credit the people who taught me about this algorithm.
> 
> I learned about the algorithm itself from the writings of Conrado
> Martinez and Salvador Roura (UPC Barcelona), and had the privilege to
> discuss algorithms and data structures with Philippe Flajolet (INRIA)
> on several occasions, whose book "An introduction to the Analysis of
> Algorithms" (with Robert Sedgewick) is also relevant to the subject.
> 
> Regards,
> 
> Marko R. Riedel


Re. sorting. I forgot to mention the paper on sorting by Uri Guttman
and Larry Rosler on www.perl.com.

Marko



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

Date: Thu, 26 Oct 2000 09:58:50 -0500
From: Martin McWhorter <m_mcwhorter@prairiegroup.com>
Subject: String Comparison
Message-Id: <39F846AA.934A1D43@prairiegroup.com>

Hello,

I am having trouble with a simple string comparison. I have paisted my
code and a sample logfile that is parsed to the bottom.

In the second if operation it checks if the $to field of the logfile eq
the $address. It clearly does, i dont understand why this isnt true?

All Help Apretiated.

Code:

#!/usr/bin/perl

# logthis.pl

# Find number incomming and outgoing 



$address = "\<person\@domain.com\>";

open (SMTP,
'/home/samba/MERCURY/E$/Netscape/Server4/msg-mercury/log/smtp/smtp');


foreach (<SMTP>) {
    if (/SMTP-Accept/) {
        ($date, $hour, $minute, $second, $notice, $module, $envelope,
$id,
$peer, $host, $from, $size, $num, $to) = split(/:/);

 
#       print "$module";


 

#       print "From: $from To: $to";

#       print $to;


        if ($from eq $address) {
            print "$date:$hour:$minute:$second From $from To $to";
            $from_count++;
        }


        if ($to eq $address) {
            print "$date:$hour:$minute:$second From $from To $to";
            $to_count++;

        }

    }

}


print "\n\n\nUser: $address From: $from_count To: $to_count\n\n\n";



Sample logfile:
[25/Oct/2000:14:21:21 -0500] mercury smtpd[408]: General Notice:
SMTP-Accept:G3033K00.13U:<39F73462.6FC72DC5@domain.com>:[104.47.1.101]:tex.domain.com:<person@domain.com>:1798:1:<jcurl@xxxx.com>
[25/Oct/2000:14:29:33 -0500] mercury smtpd[408]: General Notice:
SMTP-Accept:G303H900.53X:<ADDD6EAD41A54649957158BDEAB429D849025B@red-msg-28.redmond.corp.xxxxx.com>:[131.107.3.121]:mail5.xxxxx.com:<donnahof@xxxx.com>:2825:1:<person@domain.com>
[25/Oct/2000:14:54:55 -0500] mercury smtpd[408]: General Notice:
SMTP-Accept:G304NJ00.D3Y:<39F73C41.B122DD76@domain.com>:[104.47.1.101]:tex.domain.com:<person@domain.com>:988:1:<n_washington@domain.com>
[25/Oct/2000:15:34:07 -0500] mercury smtpd[408]: General Notice:
SMTP-Accept:G306GR00.J4C:<39F7456D.9F85A0D@domain.com>:[104.47.1.101]:tex.domain.com:<person@domain.com>:2416168:1:<tspaulin@xxxx.com>
[25/Oct/2000:17:12:33 -0500] mercury smtpd[408]: General Notice:
SMTP-Accept:G30B0X00.M4B:<BBCEA051508A9C40984CA381C28FE3C20240D74E@zeus.corp.xxxx.com>:[12.32.90.173]:pathfinder.xxxx.com:<bryafis@xxx.com>:4045:1:<person@domain.com>


(real email address have been changed to protect the innocent)


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

Date: 25 Oct 2000 23:38:00 -0500
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: two dimensional arrays
Message-Id: <m34s20rzdj.fsf@dhcp11-177.support.tivoli.com>

"Brian McDonald" <mcdonabNO@SPAMyahoo.com> writes:

> Hi. (I hope the following is not too much info to swallow...)
> 
> I have a question about how to implement a two-dimensional array in Perl.
> Specifically, what I am trying to do is create an array named @authors that
> is composed of elements of type @author, where @author is defined to be

Perl doesn't really have multi-dimensional arrays.  What it does have
is the ability to store references to arrays as elements in an array,
combined with a syntax that makes this seem like multi-dimensional
arrays.

Take a look at:
perldoc perlref
perldoc perllol

> my @author = ( $lname, $fname, $minit, $suffix, $prefix, $title,
> $affiliation, );
> 
> So, I imagine I want to declare @authors in this way...
> 
> my @authors = (
>     @author,
> );

You probably want something like:

my @authors;
push @authors, [ $lname, $fname, $minit, $suffix, $prefix, $title,
                 $affiliation ];

though a list of hashes might be more useful:

push @authors, { LNAME => $lname,
                 FNAME => $fname,
                 MINIT => $minit,
                 SUFFIX => $suffix,
                 PREFIX => $prefix,
                 TITLE => $title,
                 AFFILIATION => $affiliation,
               };

Later, when you want to loop over all of the authors, you will want
something like:

foreach my $author (@authors) {
    print "$author->[1] $author->[0] is affiliated with $author->[6]\n";
    # or  print "@$author[1,0] is affiliated with $author->[6]\n";
    # or  printf "%s %s is affiliated with %s\n", @$author[1,0,6];
}

Or, if you use a hash:

foreach my $author (@authors) {
    print "$author->{FNAME} $author->{LNAME} is affiliated with ",
          "$author->{AFFILIATION}\n";
    # the previous two alternatives work here as well, with the
    # caveat that the keys need quoting: @$author{qw(FNAME LNAME)}
}

HTH,
-- 
Ren Maddox
ren@tivoli.com


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

Date: Thu, 26 Oct 2000 16:31:36 +0200
From: "Shimon Bollinger" <bollinge@wholefamily.com>
Subject: What is the point of the new keyword 'our'?
Message-Id: <39f840ad@news.barak.net.il>

I couldn't find an answer in the Perl 5.6 FAQ.

Shimon Bollinger
webmaster@wholefamily.com

--





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

Date: Thu, 26 Oct 2000 09:47:44 -0500
From: "John Roth" <johnroth@ameritech.net>
Subject: Re: What is the point of the new keyword 'our'?
Message-Id: <svggt5jc5bci7c@news.supernews.com>


Shimon Bollinger <bollinge@wholefamily.com> wrote in message
news:39f840ad@news.barak.net.il...
> I couldn't find an answer in the Perl 5.6 FAQ.

There's quite a good description in the THIRD edition of the camel book
(Programming Perl). It allows
you to access a package global in a scope where it would otherwise be
inaccessable because it was
overridden.

John Roth

>
> Shimon Bollinger
> webmaster@wholefamily.com
>
> --
>
>
>




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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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 V9 Issue 4732
**************************************


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