[11306] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4906 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Feb 16 14:07:14 1999

Date: Tue, 16 Feb 99 11:00:29 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 16 Feb 1999     Volume: 8 Number: 4906

Today's topics:
    Re: #!/usr/bin/perl  AND #!/usr/local/bin/perl both pos (Greg Ward)
    Re: /i in regexp kills performance. (Ilya Zakharevich)
    Re: Can 2 "submit" buttons in 1 form do different thing dhosek@webley.com
    Re: Datetime manipulation in perl <Hajo@hadiko.de>
        Discuss index/search algorithms which allow flexible se Matthew.Wickline@usa.net
        Does an object have a given method? (Jack Applin)
    Re: Does an object have a given method? <tchrist@mox.perl.com>
    Re: free Perl for NT? <ludlow@us.ibm.com>
    Re: getting full path of program name <ccr@mupad.de>
        good code vs code that works <23_skidoo@geocities.com>
    Re: good code vs code that works <tchrist@mox.perl.com>
    Re: good code vs code that works (Larry Rosler)
        Help,Perl Script doesn't work! (Simon Roulstone)
    Re: Help,Perl Script doesn't work! (Simon Roulstone)
    Re: Help,Perl Script doesn't work! (Larry Rosler)
    Re: MySQL from NT <jwarner@tivoli.com>
        New posters to comp.lang.perl.misc <gbacon@cs.uah.edu>
    Re: Opening and printing textfiles containing variables <tchrist@mox.perl.com>
    Re: Parsing <trenic@nortelnetworks.ca>
        PASV Headache jsmith7350@aol.com
    Re: perl not always in /usr/bin/perl <ccr@mupad.de>
        Perl search engine <kjcox@vii.com>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: 16 Feb 1999 18:47:23 GMT
From: gward@cnri.reston.va.us (Greg Ward)
Subject: Re: #!/usr/bin/perl  AND #!/usr/local/bin/perl both posible?
Message-Id: <7acefr$aru$2@news0-alterdial.uu.net>

[me, revealing a clever trick widely known in some corners]
>A nicer but less flexible alternative comes from the Python world:
>
>#!/usr/bin/env perl
>
>This is subtle and clever, just like the "eval" hack -- but *much*
>cleaner (IMHO).  I recall having some difficulties with getting Perl to
>parse command-line options from the #! line when using the 'env' hack,
>but it seems to work just fine now.  Hmmm.

Ekkis <ekkis@arix.com> wrote:
> sorry, and what would the env.perl contain?

Read more carefully -- that's "env perl", not "env.perl".  "env" is a
standard Unix utility that lets you override environment variables for
the duration of one program run; it exists because the Bourne shell has
the capability to do this, but the C Shell does not, and poor csh lusers
sometimes need this feature.  A more normal way to use env would be eg.

   env PERL5LIB=/my/perl/lib/dir perl ...

but nobody says you *have* to put environment variables there, so you
could just as easily say

   env perl

In both cases, 'env' has to be able to find the program you want to run
-- ie. it has to search the path.  You wouldn't do this from a shell
prompt, because the shell searches the path for you.  However, in a #!
line, you're asking the kernel to run something for you -- say,
/usr/bin/perl or /usr/local/bin/perl.  The kernel doesn't search the
path; the kernel doesn't even have a notion of a search path for
executables.  That's why you have to give an explicit path.  If you give
an explicit path to "env", then you're asking *it* to search the path
for you.

Of course, this will break when Sun decides that putting env in
/opt/unix/essential_utilities/bin is a good idea.

        Greg
-- 
Greg Ward - software developer                    gward@cnri.reston.va.us
Corporation for National Research Initiatives    
1895 Preston White Drive                      voice: +1-703-620-8990 x287
Reston, Virginia, USA  20191-5434               fax: +1-703-620-0913


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

Date: 16 Feb 1999 18:54:34 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: /i in regexp kills performance.
Message-Id: <7aceta$f2d$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Larry Rosler
<lr@hpl.hp.com>],
who wrote in article <MPG.1132c4469b6214d9989a44@nntp.hpl.hp.com>:
> > 	### Takes over 19 seconds to complete
> > 	if ($LINE =~ /(test)/i) { print "Match\n"; }
> > 
> > 	### Takes only 3 seconds to complete.
> > 	if ($LINE =~ /(test)/) { print "Match\n"; }

> It is an implementation detail (extra copying) which is documented, 
> though from home I can't put my finger on it in the books.  I didn't 
> find it mentioned in the online docs or FAQ.

It is not mentioned since there is no extra copying associated with //i.

Ilya


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

Date: Tue, 16 Feb 1999 17:05:10 GMT
From: dhosek@webley.com
Subject: Re: Can 2 "submit" buttons in 1 form do different things?
Message-Id: <7ac8fv$4r$1@nnrp1.dejanews.com>

In article <36C7BC9A.D79E1768@darktech.org>,
  Justin Scott <leviathan@darktech.org> wrote:
> > Can I have 2 submit buttons in the same form that do different stuff? Can I
> > somehow pass to the perl script which button is pressed by the user? Thanks
> > for your help!

Yes, you can have two buttons that do different stuff. The form will always
execute the same script, but you can select different code by having the
buttons carry the same name but different values. Then (assuming you're using
CGI.pm) you can do something like the following:

$cgih = new CGI;

if ($cgih->param(submitButton) eq 'button1') {
  # code to handle first button's action
} else {
  # code to handle second button's action
}

Extending this to more than two buttons is left as an exercise for the reader.

-dh

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Tue, 16 Feb 1999 19:39:26 +0100
From: Hajo Pflueger <Hajo@hadiko.de>
Subject: Re: Datetime manipulation in perl
Message-Id: <36C9BB5E.90F55AA4@hadiko.de>

Hi,

> The problem is that there is no fixed sequence/order of these fields. Month or
> Day or Year could come first or in any combination.
> 
> Whatever the order is, while storing in the database, I am trying to store it
> as mm/dd/yyyy pattern, ofcourse after finding out which fields are month, day
> and year(and this is the most difficult task at present).

I guess the user is asked to enter a date, and your problem is to
"understand" what he meant. But if it is possible to enter mm/dd OR
dd/mm there is no CLEAR way to solve it. You can only say "whatever is
bigger than 12 is dd", but what if the date is 03/07? Either 03 or 07
can be dd.

You could only try to find out what year is entered. When there are 4
chars for it, it's simple. When somebody says "99" it's simple too (>31
=> year). Unfortunately your script will not be Y2K-ready, because 2001
(entered as 01) can be dd or mm too...

Sorry, but the only chance for you is to tell the user how EXACTLY he
has got to enter the date. When you use 4 chars as the year you may
offer two different ways (mm/dd/yyyy and yyyy/mm/dd e.g.), but you
cannot find out any combination. No way. If man cannot be sure what
somebody meant, how can computer? For example: My grandgrandmother is
born on 07/04/11. What date is it? Seventh of april 1911? Eleventh of
april 1907? Forth of July 1911? Maybe eleventh of July 1904?! YOU cannot
tell, neither can your script. So you have to ask the user for one kind
of combination.

Cheatah

--
I am a signature-virus. Why don't copy me into your sig?

Come to Cheatah's World at http://cheatah.net/
The World of Linkrotations, Fun and more!
Get your OWN FREE Linkrotation!


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

Date: Tue, 16 Feb 1999 17:37:27 GMT
From: Matthew.Wickline@usa.net
Subject: Discuss index/search algorithms which allow flexible search syntax
Message-Id: <7acacm$1vg$1@nnrp1.dejanews.com>

How does Altavista do it? (or any of those other big name engines)

suppose we want a search engine that allows you to search for phrases like
"Jolly Green Giant" or "in the middle" or whatever... what's a Good way to do
it that? What if we also want to allow stemming? ... using oncolog* to match
oncology oncologist or oncological

Has an optimal solution already been found by folks? If not, anyone care to
start a thread and figure it out here for future posterity?

I'm thinking that an index is of course good to start with, as it will speed
up bareword searches. For phrases, would it be best to manually open each
file which the index lists as having every component word in the phrase and
see if it matches? Or maybe it would be better to have the index be
conceptually like the following where a record of word location is stored
with each matching file...

index = {
    word_a => {
        matching_file_1 => [2, 47, 115, 284], # 2nd word in file, 47th, etc
    },
    word_b => {
        matching_file_1 => [3, 48],
        matching_file_2 => [25],
        matching_file_3 => [83, 174],
    },
}

In that example, "word_a word_b" can be see to exist in matching_file_1

Doing something like that would potentially mess up stop word optimizations
unless both the indexed text and the query phrases are purged of stop words
(indexed text purged just prior to indexing).

Is there a more efficient way to support phrase searching with an index?


What about stemming, and even phrases which incorporate stemming? It seems
that an index of the above sort could support these features, but maybe some
other sort of index is more appropriate?

Take the case of a search like "terma* termb termc termc*"... an optimized
approach would be to first apply the above approach to the case of "termb
termc" to get an initial list of possible matches. Then it would see if
tacking on the previous terma* leaves any matches.

Depending on the data, it might be best to look in an index by files rather
than by words (anyone have thoughts on how to tell which way a particular
data set should be indexed?). If we have an index by files, then

for each file in our initial list of matches {
    for each indexed word in that file {
        if word matches stem pattern and exists in proper location,
        then this file matches
    }
}

Depending on whether we want to tally relevancy scores for multiple matches,
we might want to jump out when we find that a file matches. Well, if we have
additional stems to fold into the phrase, we'd be able to jump out as soon as
we have a match, and then save any relevancy tallying for when we fold in the
final stem into the phrase.

 ... so in this case, we'd have one last stem to fold into the phrase and
search only our revised list of possible phrase-matching files based on our
last pass through.


All of this seems a bit icky, and rather than jump in only to find that
there's something obviously better, I'd love to hear lots of chatter/ideas
about algorithms etc...

I realize this is not a perl-specific question, but the implementation will be
in perl, and I didn't see any generic-algorithm newsgroup (there was one for
algorithms in games programming though :)

-matt
email cc appreciated, not required

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: 16 Feb 1999 17:59:39 GMT
From: neutron@fc.hp.com (Jack Applin)
Subject: Does an object have a given method?
Message-Id: <7acbmb$s9e$1@fcnews.fc.hp.com>

I want to find out, at run-time, whether an object has a given method
defined.  The following doesn't work:

	#! /usr/bin/perl -w

	package Foo;

	sub new { bless [] }

	sub alpha {
		print "alpha was called\n";
		return undef;
	}

	package main;

	$f = new Foo;

	print defined($f->alpha) ? "defined\n" : "not defined\n";

It actually calls Foo::alpha, and prints this:

	alpha was called
	not defined

I want it to just tell if Foo::alpha exists, not to call it.
This seems to work:

	print defined(&Foo::alpha) ? "defined\n" : "not defined\n";

However, I don't want to hard-code the package name, because the object
that I'm dealing with may be of several classes.

This works, but it's horrible.  Any suggestions?
    print eval "defined(&".ref($f)."::alpha)" ? "defined\n" : "not defined\n";



						-Jack Applin
						 neutron@fc.hp.com


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

Date: 16 Feb 1999 11:36:19 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Does an object have a given method?
Message-Id: <36c9baa3@csnews>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    neutron@fc.hp.com (Jack Applin) writes:
:I want to find out, at run-time, whether an object has a given method
:defined.  

You mean like by using the can() method, inherited by all classes 
from UNIVERSAL?

    if ($obj->can("copy")) { .... }

--tom
-- 
"The number of UNIX installations has grown to 10, with more expected."
    - _The UNIX Programmer's Manual_, Second Edition, June, 1972.


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

Date: Tue, 16 Feb 1999 11:01:01 -0600
From: James Ludlow <ludlow@us.ibm.com>
Subject: Re: free Perl for NT?
Message-Id: <36C9A44D.F93E96D7@us.ibm.com>

Todd Anthony Delong wrote:
 
> I have project coming up that will involve Perl development on the PC
> (probably under NT).  I realize that I can purchase the Win32 Perl package
> from O'Reilly, but I was wondering if there is a version of Perl 5 for NT for
> "free" (where a small donation is greatly appreciated).  Ordinarily, I

You're thinking of Perl Resource Kit that ORA puts out.  Yes, it comes
with perl, but that's not what you're paying for.  You're paying for all
of the extras that they throw in.  perl is free, and the version that
comes with Perl Resource Kit - Win32 is distributed by ActiveState
Tools.  It's called ActivePerl, and it's free.

www.activestate.com
www.perl.com

-- 
James Ludlow (ludlow@us.ibm.com)
(Any opinions expressed are my own, not necessarily those of IBM)


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

Date: 16 Feb 1999 19:09:38 +0100
From: Christopher Creutzig <ccr@mupad.de>
Subject: Re: getting full path of program name
Message-Id: <wqsemnqusnx.fsf@mupad.de>

gward@cnri.reston.va.us (Greg Ward) writes:

>    $script = $0;
>    $script = File::Spec->join (getcwd, $script)
>       unless File::Spec->file_name_is_absolute ($script);
>    ($script) = File::Spec->no_upwards (File::Spec->canonpath ($script));
> 
> This works (at least under Unix -- but then File::Spec is designed for

 Only if the user has . in $PATH, which is (fortunately) very unlikely.

-- 
    +--+
   +--+|   
   |+-|+            Christopher Creutzig (ccr@mupad.de)
   +--+                     Tel.: 05251-60-3203


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

Date: Tue, 16 Feb 1999 16:47:10 +0000
From: 23_skidoo <23_skidoo@geocities.com>
Subject: good code vs code that works
Message-Id: <36C9A100.1299@geocities.com>

is it considered bad practice to use return to jump out of a foreach
loop in a subroutine? my reason for asking:

i'm writing a cgi subroutine (shown below) which compares an email
address against a blacklist text file containing email addresses and the
reasons they were banned. it works but i don't want develop bad habits
as they tend to trip you up further down the road. any pointers
appreciated

also, 
foreach local $user (@badusers)

doesn't work, are variables local by default when used in a foreach
loop? if not, how can i localise them so that i can cut and paste subs
into other programs without worrying that i might corrupt a global
variable?

thanks

-23



if (&banned($input{'email'})) {
	print "Sorry, this email address has been banned for the following
reason:<br>\n";
	print "$ban_reason<br>\n";
	print "<a href=\"$homepage\" target=\"_top\">back</a><br>\n";
}

sub banned {
	local $checker = "@_";

	open (BANNED, "$banlist") || print "can't open $banlist on line " .
__LINE__ . "<br>\n";
		local @badusers = <BANNED>;
	close (BANNED);

	foreach $user (@badusers) {
		if ($user =~ /^$checker\t/i) {
			($ban_reason) = $user =~ /\t(.*)\n/;
			return 1;
		}
	}
	return 0;
}


the datafile looks like this:

henry@someplace.com	Abusive language in guestbook - 12th Jan 1999
bill@microsoft.com	You are the antichrist!


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

Date: 16 Feb 1999 11:15:47 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: good code vs code that works
Message-Id: <36c9b5d3@csnews>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    23_skidoo@geocities.com writes:
:are variables local by default when used in a foreach
:loop? 

Yes, sometimes, if there's no lexical in scope.
But then it's a local, which is really a global.
This is all explained in the perlsyn manpage.

--tom
-- 
Real programmers can write assembly code in any language.   :-)  
                --Larry Wall in  <8571@jpl-devvax.JPL.NASA.GOV>


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

Date: Tue, 16 Feb 1999 10:45:03 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: good code vs code that works
Message-Id: <MPG.11335c8f4b9b7654989a48@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <36C9A100.1299@geocities.com> on Tue, 16 Feb 1999 16:47:10 
+0000, 23_skidoo <23_skidoo@geocities.com> says...
> is it considered bad practice to use return to jump out of a foreach
> loop in a subroutine?

Not by most programmers.  Only some purists who believe that a function 
should have exactly one return statement, and that that should be at the 
end of the function, would object to it.  My guess is that such people 
would more likely program in Pascal than in Perl.  :-)

> also, 
> foreach local $user (@badusers)
> 
> doesn't work, are variables local by default when used in a foreach
> loop? if not, how can i localise them so that i can cut and paste subs
> into other programs without worrying that i might corrupt a global
> variable?

Use 'my' instead of 'local', and the scope of the loop iterator will be 
confined to the loop.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Tue, 16 Feb 1999 05:19:59 +0000
From: Webmaster@KILL-MEquorndon-mag.org.uk (Simon Roulstone)
Subject: Help,Perl Script doesn't work!
Message-Id: <Webmaster-1602990520000001@whaserv.demon.co.uk>

Hi All,

Sorry to bother you, but I'm trying to get this simple cgi script to work
on website, and no matter what I do, it still doesn't work.
The script is for a simple banner rotation, any ideas?, the scripts are below,
I have asked the admin to check that perl scrips are supported, and he
assures me they are.

test.html
---------

<IMG SRC="/cgi-bin/image.pl" WIDTH=400 HEIGHT=40 BORDER=0>


image.pl
=========

#!/usr/bin/perl
    $|=1;
    $mypic[0]="tbanner0.gif";
    $mypic[1]="tbanner1.gif";
    $mypic[2]="tbanner2.gif";
    srand(time ^ $$);
    $pick = rand(@mypic);
    print "Content-type: image/gif\n\n";
    open (BANNER,$mypic[$pick]);
    print <BANNER> ;
    close (BANNER);
     

images are in the same directory as the image.pl (cgi-bin/image.pl)
If you have any ideas, I would be very gratefull. I am not fully genned
up on perl, so please make it as painless as possible!

I look forward to hearing from you,

Simon.

-- 

Simon Roulstone
Webmaster@KILL-MEquorndon-mag.org.uk
http://www.quorndon-mag.org.uk/

Remove KILL-ME from email address when replying by
email, Thankyou.


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

Date: Tue, 16 Feb 1999 05:23:55 +0000
From: Webmaster@KILL-MEquorndon-mag.org.uk (Simon Roulstone)
Subject: Re: Help,Perl Script doesn't work!
Message-Id: <Webmaster-1602990523560001@whaserv.demon.co.uk>

Sorry, I forgot to mention the server is an NT System.

Simon

-- 

Simon Roulstone
Webmaster@KILL-MEquorndon-mag.org.uk
http://www.quorndon-mag.org.uk/

Remove KILL-ME from email address when replying by
email, Thankyou.


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

Date: Tue, 16 Feb 1999 10:24:31 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Help,Perl Script doesn't work!
Message-Id: <MPG.113357be20fe4ec0989a46@nntp.hpl.hp.com>

In article <Webmaster-1602990523560001@whaserv.demon.co.uk> on Tue, 16 
Feb 1999 05:23:55 +0000, Simon Roulstone <Webmaster@KILL-MEquorndon-
mag.org.uk> says...
> Sorry, I forgot to mention the server is an NT System.

I would have guessed as much!

`perldoc -f binmode`

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Tue, 16 Feb 1999 10:45:30 -0600
From: John Warner <jwarner@tivoli.com>
Subject: Re: MySQL from NT
Message-Id: <36C9A0AA.AA612B4B@tivoli.com>

I answered something similar to this yesterday so I've just copied and pasted
the contents here...

#!/usr/local/bin/perl -w
use DBI;
use DBD::ODBC;
# Connects to a play MS Access db  DBD::ODBC
 my $dbh = DBI->connect($srvr, $srvr_db_login, $srvr_db_pwd, { RaiseError =>
1});

 my $sqlstmt = "SELECT uid,password FROM UserInfo WHERE uid=\'$name\'";
 my $sth = $dbh->prepare("$sqlstmt")or die "Cannot prepare statement:
$DBI::errstr\n";
$sth->execute;
while (@row = $sth->fetchrow_array) {
    $n = $row[0];   #name
    $p = $row[1];   #password
    ....do stuff here...
 }
 ...or here depending upon what you're up to...

NOTE:  I can only get away with using $row[n] here because I know the format of
the data returned by the SQL statement happens to be the same order as in the
SQL statement.  I don't know if that is always the expected behavior but from
my own explorations into DBI/DBD it has always been so.  Does anybody know the
answer to that?

$srvr, $srvr_db_login, and $srvr_db_pwd are read in from a config file where the
config file contains:

# ODBC Settings
# srvr must be a defined system DSN.
srvr = dbi:ODBC:PERL_EXAMPLE
srvr_db_login =''
srvr_db_pwd = ''

In my simple test case where I'm using MS Access on a db without any security
enabled, the srvr_db_login and srvr_db_pwd variables are superfluous.  However,
if I implement Access' security, I can simply change the config file and be on
my merry way.  The $srvr variable is set to a defined System DSN on my NT
workstation.

--John

Eric Adkinson wrote:

> I am trying to access a MySQL db from Windows NT with Active Perl.  I have
> the DBI package installed and I keep reading about the DBD::MySQL package,
> but I can't find it anywhere.  Does anyone know where I can find it?
>
> Alternately, can anyone give me guidance on the use of the DBD::ODBC package
> to accomplish this task?
>
> Thanks in advance for your help.
>
> Eric



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

Date: 16 Feb 1999 17:40:06 GMT
From: Greg Bacon <gbacon@cs.uah.edu>
Subject: New posters to comp.lang.perl.misc
Message-Id: <7acahm$erd$2@info.uah.edu>

Following is a summary of articles from new posters spanning a 7 day
period, beginning at 08 Feb 1999 16:50:26 GMT and ending at
14 Feb 1999 04:19:28 GMT.

Notes
=====

    - A line in the body of a post is considered to be original if it
      does *not* match the regular expression /^\s{0,3}(?:>|:|\S+>|\+\+)/.
    - All text after the last cut line (/^-- $/) in the body is
      considered to be the author's signature.
    - The scanner prefers the Reply-To: header over the From: header
      in determining the "real" email address and name.
    - Original Content Rating (OCR) is the ratio of the original content
      volume to the total body volume.
    - Find the News-Scan distribution on the CPAN!
      <URL:http://www.perl.com/CPAN/modules/by-module/News/>
    - Please send all comments to Greg Bacon <gbacon@cs.uah.edu>.
    - Copyright (c) 1998 Greg Bacon.  All Rights Reserved.
      Verbatim copying and redistribution is permitted without royalty;
      alteration is not permitted.  Redistribution and/or use for any
      commercial purpose is prohibited.

Totals
======

Posters:  217 (47.0% of all posters)
Articles: 305 (25.2% of all articles)
Volume generated: 491.4 kb (24.7% of total volume)
    - headers:    215.7 kb (4,481 lines)
    - bodies:     268.0 kb (8,636 lines)
    - original:   203.5 kb (6,775 lines)
    - signatures: 7.4 kb (185 lines)

Original Content Rating: 0.759

Averages
========

Posts per poster: 1.4
    median: 1 post
    mode:   1 post - 165 posters
    s:      1.1 posts
Message size: 1650.0 bytes
    - header:     724.2 bytes (14.7 lines)
    - body:       899.9 bytes (28.3 lines)
    - original:   683.1 bytes (22.2 lines)
    - signature:  24.9 bytes (0.6 lines)

Top 10 Posters by Number of Posts
=================================

         (kb)   (kb)  (kb)  (kb)
Posts  Volume (  hdr/ body/ orig)  Address
-----  --------------------------  -------

    7    13.9 (  5.6/  6.6/  3.4)  "David M. Lloyd" <david@inxpress.net>
    6     7.1 (  4.1/  3.1/  1.3)  Bill Garrett <bgarrett@hamilton.net>
    6     7.8 (  3.4/  4.4/  1.5)  "Fuzzy " <fuzzy825@hotmail.com>
    5    10.8 (  3.6/  7.2/  3.5)  jjds@para-protect.com
    4     4.7 (  2.8/  1.9/  1.3)  Ka-shu Wong <kswong@bigpond.com>
    4     6.0 (  3.6/  2.4/  0.7)  "Martin Lvnnar" <martin.lonnar@edt.ericsson.se>
    4     5.5 (  2.7/  2.8/  2.1)  "Bradley J. Gibby" <bgibby@iinet.net.au>
    4    10.7 (  3.9/  6.8/  6.8)  Lars Marius Garshol <larsga@ifi.uio.no>
    4     7.1 (  2.5/  4.5/  1.8)  "Michael Taylor" <ringo6@worldnet.att.net>
    4     8.5 (  3.2/  5.3/  4.5)  paxtond@nospam.ix.netcom.com

These posters accounted for 4.0% of all articles.

Top 10 Posters by Volume
========================

  (kb)   (kb)  (kb)  (kb)
Volume (  hdr/ body/ orig)  Posts  Address
--------------------------  -----  -------

  13.9 (  5.6/  6.6/  3.4)      7  "David M. Lloyd" <david@inxpress.net>
  10.8 (  3.6/  7.2/  3.5)      5  jjds@para-protect.com
  10.7 (  3.9/  6.8/  6.8)      4  Lars Marius Garshol <larsga@ifi.uio.no>
  10.3 (  1.5/  8.7/  8.6)      2  "Matt Arnold" <marnold@novia.net>
   8.5 (  3.2/  5.3/  4.5)      4  paxtond@nospam.ix.netcom.com
   7.8 (  3.4/  4.4/  1.5)      6  "Fuzzy " <fuzzy825@hotmail.com>
   7.6 (  0.8/  6.9/  4.4)      1  mdlong@omnifcu.org
   7.1 (  4.1/  3.1/  1.3)      6  Bill Garrett <bgarrett@hamilton.net>
   7.1 (  2.5/  4.5/  1.8)      4  "Michael Taylor" <ringo6@worldnet.att.net>
   6.0 (  3.6/  2.4/  0.7)      4  "Martin Lvnnar" <martin.lonnar@edt.ericsson.se>

These posters accounted for 4.5% of the total volume.

Top 10 Posters by OCR (minimum of three posts)
==============================================

         (kb)    (kb)
OCR      orig /  body  Posts  Address
-----  --------------  -----  -------

1.000  (  2.3 /  2.3)      3  mduwjd@maersk.com
1.000  (  6.8 /  6.8)      4  Lars Marius Garshol <larsga@ifi.uio.no>
1.000  (  1.9 /  1.9)      3  "William M. Toohey" <ceo@mptenterprises.com>
0.959  (  2.0 /  2.1)      3  g200@my-dejanews.com
0.847  (  4.5 /  5.3)      4  paxtond@nospam.ix.netcom.com
0.749  (  2.1 /  2.8)      4  "Bradley J. Gibby" <bgibby@iinet.net.au>
0.726  (  0.4 /  0.6)      3  KC <dont@send.me.nothing>
0.661  (  1.3 /  1.9)      4  Ka-shu Wong <kswong@bigpond.com>
0.562  (  1.2 /  2.1)      3  cybpunk@geocities.com (John G)
0.509  (  3.4 /  6.6)      7  "David M. Lloyd" <david@inxpress.net>

Bottom 10 Posters by OCR (minimum of three posts)
=================================================

         (kb)    (kb)
OCR      orig /  body  Posts  Address
-----  --------------  -----  -------

0.562  (  1.2 /  2.1)      3  cybpunk@geocities.com (John G)
0.509  (  3.4 /  6.6)      7  "David M. Lloyd" <david@inxpress.net>
0.487  (  3.5 /  7.2)      5  jjds@para-protect.com
0.407  (  1.3 /  3.1)      6  Bill Garrett <bgarrett@hamilton.net>
0.404  (  1.8 /  4.5)      4  "Michael Taylor" <ringo6@worldnet.att.net>
0.365  (  0.7 /  1.9)      3  EMAG-Herzberg@t-online.de (Administrator)
0.334  (  1.5 /  4.4)      6  "Fuzzy " <fuzzy825@hotmail.com>
0.272  (  0.7 /  2.4)      4  "Martin Lvnnar" <martin.lonnar@edt.ericsson.se>
0.267  (  0.5 /  1.8)      3  =?iso-8859-1?Q?Cyb=EER?= <cybir@echoweb.net>
0.193  (  0.6 /  3.1)      3  Burton Kent <burton@lucent.com>

18 posters (8%) had at least three posts.


Top 10 Crossposters
===================

Articles  Address
--------  -------

       7  bt@Gaia.teknon.de (Volker Borchert)
       7  Philip Shotton <phil@iisc.co.uk>
       7  vitus@wagner.rinet.ru (Victor Wagner)
       6  TechNET Staff <technet@cyberghost.org>
       6  Lars Marius Garshol <larsga@ifi.uio.no>
       3  alex@mediaconsult.com
       2  mgogala@yahoo.com
       2  mb@nospamplease.matchfonts.com (Michel Bujardet)
       2  haible@clisp.cons.org (Bruno Haible)
       2  Thomas Ackermann <tgm@math.uni-bonn.de>


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

Date: 16 Feb 1999 11:05:22 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Opening and printing textfiles containing variables
Message-Id: <36c9b362@csnews>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, arno_22@hotmail.com writes:
:The output of the code is exactly the same as the textfile. Why doens't perl
:change $var in 'Even more blabla'. What do I have to do to solve this problem?

Don't create it in the first place?  I don't know.  Seems like a silly
thing.  It's answered in the FAQ, also -- see man perlfaq4 about this.
And here's a new entry.

--tom

=head2 How can I use a variable as a variable name?

Beginners often think they want to have a variable contain the name
of a variable.

    $fred    = 23;
    $varname = "fred";
    ++$$varname;         # $fred now 24

This works I<sometimes>, but it is a very bad idea for two reasons.

The first reason is that they I<only work on global variables>.
That means above that if $fred is a lexical variable created with my(),
that the code won't work at all: you'll accidentally access the global
and skip right over the private lexical altogether.  Global variables
are bad because they can easily collide accidentally and in general make
for non-scalable and confusing code.

Symbolic references are forbidden under the C<use strict> pragma.
They are not true references and consequently are not reference counted
or garbage collected.

The other reason why using a variable to hold the name of another
variable a bad idea is that the question often stems from a lack of
understanding of Perl data structures, particularly hashes.  By using
symbolic references, you are just using the package's symbol-table hash
(like C<%main::>) instead of a user-defined hash.  The solution is to
use your own hash or a real reference instead.

    $fred    = 23;
    $varname = "fred";
    $USER_VARS{$varname}++;  # not $$varname++

There we're using the %USER_VARS hash instead of symbolic references.
Sometimes this comes up in reading strings from the user with variable
references and wanting to expand them to the values of your perl
program's variables.  This is also a bad idea because it conflates the
program-addressable namespace and the user-addressable one.  Instead of
reading a string and expanding it to the actual contents of your program's
own variables:

    $str = 'this has a $fred and $barney in it';
    $str =~ s/(\$\w+)/$1/eeg;		  # need double eval

Instead, it would be better to keep a hash around like %USER_VARS and have
variable references actually refer to entries in that hash:

    $str =~ s/\$(\w+)/$USER_VARS{$1}/g;   # no /e here at all

That's faster, cleaner, and safer than the previous approach.  Of course,
you don't need to use a dollar sign.  You could use your own scheme to
make it less confusing, like bracketed percent symbols, etc.

    $str = 'this has a %fred% and %barney% in it';
    $str =~ s/%(\w+)%/$USER_VARS{$1}/g;   # no /e here at all

Another reason that folks sometimes think they want a variable to contain
the name of a variable is because they don't know how to build proper
data structures using hashes.  For example, let's say they wanted two
hashes in their program: %fred and %barney, and to use another scalar
variable to refer to those by name.

    $name = "fred";
    $$name{WIFE} = "wilma";     # set %fred

    $name = "barney";           
    $$name{WIFE} = "betty";	# set %barney

This is still a symbolic reference, and is still saddled with the
problems enumerated above.  It would be far better to write:

    $folks{"fred"}{WIFE}   = "wilma";
    $folks{"barney"}{WIFE} = "betty";

And just use a multilevel hash to start with.

The only times that you absolutely I<must> use symbolic references are
when you really must refer to the symbol table.  This may be because it's
something that can't take a real reference to, such as a format name.
Doing so may also be important for method calls, since these always go
through the symbol table for resolution.

In those cases, you would turn off C<strict 'refs'> temporarily so you
can play around with the symbol table.  For example:

    @colors = qw(red blue green yellow orange purple violet);
    for my $name (@colors) {
        no strict 'refs';  # renege for the block
        *$name = sub { "<FONT COLOR='$name'>@_</FONT>" };
    } 

All those functions (red(), blue(), green(), etc.) appear to be separate,
but the real code in the closure actually was compiled only once.

So, sometimes you might want to use symbolic references to directly
manipulate the symbol table.  This doesn't matter for formats, handles, and
subroutines, because they are always global -- you can't use my() on them.
But for scalars, arrays, and hashes -- and usually for subroutines --
you probably want to use hard references only.
-- 
    "111% of crap is everything." --Larry Wall


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

Date: Tue, 16 Feb 1999 12:30:38 -0500
From: Tom Renic <trenic@nortelnetworks.ca>
Subject: Re: Parsing
Message-Id: <36C9AB3E.8A58D80B@nortelnetworks.ca>

Thank you both for your help but for some reason it still won't work,
the output I get is:

Tom Renic~trenic@nortelnetworks.com~123456~Tom Renic~123 Easude Way
,Dallas, Texas
,1232~Tom Renic~...

Rather than:

Tom Renic~trenic@nortelnetworks.com~123456~Tom Renic~123 Easude Way, Dallas,
Texas, 1232~Tom Renic~...

I used the tr code you provided it still didn't work. Any clues?


Larry Rosler wrote:

> In article <Pine.A41.4.02.9902151805330.36014-
> 100000@ginger.libs.uga.edu> on Mon, 15 Feb 1999 18:16:12 -0500, Brad
> Baxter <bmb@ginger.libs.uga.edu> says...
> > On Mon, 15 Feb 1999, Tom Renic wrote:
> > >                # The problem begins when I get to the $OfficeAddress
> > > variable, since an address has usually more than one
> > >                # line, seperated by enter characters. What I would like
> > > to do is replace the enter strokes with a comma.
> >
> > Try 'split' and 'join':
> ...
> >     join( ",", split( /\n/, $OfficeAddress ) ),
>
> That is painfully slow and complicated compared to 'tr':
>
>     $OfficeAddress =~ tr/\n/,/;
>
> --
> (Just Another Larry) Rosler
> Hewlett-Packard Company
> http://www.hpl.hp.com/personal/Larry_Rosler/
> lr@hpl.hp.com



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

Date: Tue, 16 Feb 1999 18:42:12 GMT
From: jsmith7350@aol.com
Subject: PASV Headache
Message-Id: <7ace61$5o3$1@nnrp1.dejanews.com>

I'm writing a simple perl script in Windows95 to ftp to/from servers using the
Net::FTP module.  While certain methods work fine (new(), login(),cwd()) other
methods do not seem to work at all(ls(),get()).  When I run debug with the
script the machine tells me the following:

Net::FTP=GLOB(0x65922c)<<<230 User JCS logged in  #so I know i'm connected
Net::FTP=GLOB(0x65922c)>>>PASV	#this is what is sent with the ls or get
method Net::FTP=GLOB(0x65922c)<<<502 PASV command not implemented #What's
up???

Does this mean I'm running in passive mode?  Has anyone experienced the libnet
module interpreting commands as PASV?
Any help would be greatly appreciated.

Thanks in advance.
JS

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: 16 Feb 1999 17:47:11 +0100
From: Christopher Creutzig <ccr@mupad.de>
Subject: Re: perl not always in /usr/bin/perl
Message-Id: <wqshfsmuwhc.fsf@mupad.de>

Jonathan Stowe <gellyfish@btinternet.com> writes:

> So that is apparently not an option. Like was said using env could be a
> solution but it might not be portable to all varieties of Unix.  Some
> systems also will allow you to simply put:
> 
> #!perl
> 
> and the interpreter will be found in the path but that cannot be said to
> be portable at all.  
> 
> A better solution which would locate the perl on the platform and edit
> the program file inplace to reflect the location of this perl.

 I still think an even better solution would be to read the perl
documentation and follow the example in 'perldoc perlrun':

         #!/bin/sh -- # -*- perl -*- -p
         eval 'exec /usr/bin/perl -wS $0 ${1+"$@"}'
             if $running_under_some_shell;

-- 
    +--+
   +--+|   
   |+-|+            Christopher Creutzig (ccr@mupad.de)
   +--+                     Tel.: 05251-60-3203


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

Date: Tue, 16 Feb 1999 17:55:40 +0000
From: "Kerry J. Cox" <kjcox@vii.com>
Subject: Perl search engine
Message-Id: <36C9B11C.2A395595@vii.com>

I am looking for a quick and easy search engine to use with a lot of
files located ona CD-ROM.  I want to have the user be able to input a
query and have it search through some specific directories on the CD and
then give a result.  This would be entirely independant of any server,
but the user would be accessing the CD via a browser.  So a simple HTML
based Perl search engine would be the key.
Any suggestions?
Thanks.
KJ

--
 .-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-.
| Kerry J. Cox          Vyzynz International Inc.   |
| kjcox@vii.com         Systems Administrator       |
| (801) 596-7795        http://vii.com              |
| All Things Linux      http://quasi.vii.com/linux/ |
`---------------------------------------------------'





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

Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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.misc (and this Digest), send your
article to perl-users@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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 4906
**************************************

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