[9569] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3163 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jul 15 12:08:26 1998

Date: Wed, 15 Jul 98 09:00:41 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 15 Jul 1998     Volume: 8 Number: 3163

Today's topics:
    Re: -w on production code (was Re: better way of gettin (Clinton Pierce)
    Re: -w on production code (Scott Erickson)
    Re: AWK Interpreter <bbense+comp.lang.perl.misc.Jul.15.98@telemark.stanford.edu>
    Re: Chomp() on win32 and unix perl (Jeffrey R. Drumm)
        Custom Programming Job <selipson@computercoach.com>
    Re: Editing files merzky@physik.hu-berlin.de
    Re: Editing files (Larry Rosler)
    Re: efficiency: print<<"xxx" vs. print (Mark-Jason Dominus)
    Re: Globbing from a list (Scott Erickson)
    Re: HTML <SELECT MULTIPLE> var to Perl script? (Mark-Jason Dominus)
    Re: I am an "antispam spammer"? (I R A Aggie)
    Re: inconstant behavior of constants <jefpin@bergen.org>
    Re: Indentation <rra@stanford.edu>
        Nonblocking, buffered input <andrew@watson.ibm.com>
    Re: Nonblocking, buffered input <andrew@watson.ibm.com>
    Re: passing variables by reference (Larry Rosler)
    Re: Perl Beautifier Home Page <rra@stanford.edu>
    Re: Perl Beautifier Home Page <jdporter@min.net>
    Re: Perl Database Problem (Mark-Jason Dominus)
    Re: perl IDE and compiler <Gregory.Rebuck@digital.com>
        Perl zipping files?? <e.christensen@netjob.dk>
    Re: Pre-pending data to a database or file. (Jeff Yoak)
    Re: Pre-pending data to a database or file. (Larry Rosler)
    Re: Pre-pending data to a database or file. <fmfluh00@pop.uky.edu>
        Q: Changing IP address via perl <at@whatsamattau.edu>
    Re: Regular expression matech for ( non-fixed number of (Larry Rosler)
    Re: Remote registry editing on NT <markstang@ncgroup.com>
    Re: Sticking in NULL after split (Mark-Jason Dominus)
    Re: Sticking in NULL after split (Douglas Wilson)
        The three properties of programmers <markstang@ncgroup.com>
    Re: The three properties of programmers (Tina Marie Holmboe)
    Re: The three properties of programmers <pdcawley@bofh.org.uk>
    Re: The three properties of programmers <quentin.fennessy@amd.com>
        Unwanted reference after variable assignement (Franz Kaufmann)
    Re: Unwanted reference after variable assignement (David A. Black)
        working on /etc/passwd in a multi-user env. <fgueant@orka-intl.com>
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: 15 Jul 1998 14:03:19 GMT
From: cpierce1@cp500.fsic.ford.com (Clinton Pierce)
Subject: Re: -w on production code (was Re: better way of getting the last modified file?)
Message-Id: <6oicr7$pr61@eccws1.dearborn.ford.com>

In article <35A43CE9.12DE4274@aquila.com>,
	"Michael D. Schleif" <mike.schleif@aquila.com> writes:
>Wow!
>
>This is really the coolest thread in quite sometime!
>
>Let me toss this bone to the wolves:
>
>	If "-w" and "use strict" were compiled-in-standard in Perl, how would
>that affect the postings to clpm?  What would change here?
>

It would make it a royal pain-in-the-ass to just toss off a quick 
script or a one-liner to do some task.  Every newbie would be in here
whining that Perl has become "Pascal of the 1990s".  Teaching Perl
would be neigh impossible--an no fun to learn.  

Postings of the sort "WHY did I get this error..." without reading the
appropriate documentation would be everywhere.  Newbies wouldn't be able
to construct even simple scripts without warnings.  Carnage, bloodshed,
and mayhem everywhere.  The Web Groups would be deluged with "that f@#$ing
Perl interpreter is filling my logfiles."  Oh The Humanity.

No, this is an idea whose time should never come.

Perl must always be able to be spoken at the toddler level.  Infant Perl
is very important in the larval stage.  "-w" and "use strict" are 
professional grammarians hanging over the toddler correcting grammar.
No.

-- 
+------------------------------------------------------------------------+
|  Clinton A. Pierce    |   "If you rush a Miracle Man,   | http://www.  |
|  cpierce1@ford.com    |     you get rotten miracles"    | dcicorp.com/ |
| fubar@ameritech.net   |--Miracle Max, The Princess Bride| ~clintp      |
+------------------------------------------------------------------------+
GCSd-s+:+a-C++UALIS++++P+++L++E---t++X+b+++DI++++G++e+>++h----r+++y+++>y*



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

Date: Wed, 15 Jul 1998 15:37:25 GMT
From: Scott.L.Erickson@HealthPartners.com (Scott Erickson)
Subject: Re: -w on production code
Message-Id: <35accc03.7589883@news.mr.net>

Previously, tina@scandinaviaonline.se (Tina Marie Holmboe) wrote:

>In article <6o2q10$duh$1@client3.news.psi.net>,
>	abigail@fnx.com (Abigail) writes:
>
>> ++   *Lots* of our new programmers do that. But they don't add -w to their
>> ++   *development* code.
>> 
>> You need better guidelines, and a QA system.
>
>  No shit, Sherlock!
>
>  And that answer of yours will certainly fix aaaaall my problems with
>  overflowing logs during today, tomorrow, and the next 2 years whilst
>  they get around to *getting* what you describe above.
>
>  Great answer. Good solution. Very down-to-earth like... yup.

Are you implying that having better guidelines and a QA system are
useless because you are having problems now? That is what I am reading
from your response. If that is your attitude, then there is no point
in ever trying to improve because you might not see the fruits of your
labor for another year or more. Thank god there are visionaries in my
company, not many, who want to improve how things are done.

Scott.




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

Date: 15 Jul 1998 14:30:15 GMT
From: <bbense+comp.lang.perl.misc.Jul.15.98@telemark.stanford.edu> ;
Subject: Re: AWK Interpreter
Message-Id: <6oiedn$2ng$1@nntp.Stanford.EDU>



In article <35ACA18F.2997D9D@wanadoo.com>,
Eric Zylberstejn  <Eric.Zylberstejn@wanadoo.com> wrote:
>-=-=-=-=-=-
>
>Hello.
>
>David Reynolds wrote:
>> 
>> I am learning Perl and have have programmed a great deal in AWK.  I was
>> looking for a perl program that converted AWK code to Perl.  I would like to
>> see the differences between the two.
>
>It's a2p. It's part of the standard Perl distribution. Unfortunately, this is
>program, and the produced Perl is not the best you can write.
>I'd rather rewrite from scratch than use a2p. Especially since you can control
>how you read lines in Perl.
>
>

- - Well, I'll probably regret this, but I found a2p extremely useful in
learning perl. A2p writes perl4 which can be a problem, but with the
Camel you can learn alot by "fixing' your scripts that go through a2p.

- - Of course, this was all eight years ago when there was alot less
perl to learn.

- - Another tool that's useful for getting started is find2perl. For me,
just getting some basic structure in place and then hacking on the
resulting source is best way to learn. I've always been a sucker for 
the stone soup trick. 

- - Another useful learning tool is to take somebody else's script and
mess with it. Be careful whose scripts you pick, perl can be a
write-only language in the hands of the cruel. 

- - Booker C. Bense 


Version: 2.6.2

iQCVAwUBNay89AD83u1ILnWNAQFclAQAgyerfSDKaJXwc8eiWBOTx0RPTim0D7+b
8d+DZ15ai8hCbnCbadvDLeAQcpWXlI7cyUElp/3MZjp+iijMXHap+98vGuXIt1Iy
9kpjsME0aJgXkOoMX1KRj81Bp5vlceDCH5k4qa29VZPSnnq0t9CXlNj0OW4YYQzS
m4+OrgNKPkY=
=LI7F
-----END PGP SIGNATURE-----


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

Date: Wed, 15 Jul 1998 14:20:30 GMT
From: drummj@mail.mmc.org (Jeffrey R. Drumm)
Subject: Re: Chomp() on win32 and unix perl
Message-Id: <35ac95ab.693227087@news.mmc.org>

On Wed, 15 Jul 1998 07:57:32 GMT, Marc.Haber-usenet@gmx.de (Marc Haber) wrote:

(snip)

>Imagine developing a perl script on a UNIX box while sitting at a
>Windows machine's console. It is much more comfortable to have a
>Windows editor editing the script file over a samba or NFS connection,
>do a simple save, click over to the ssh connection to the UNIX box and
>run the script instead of editing in the ssh window or saving locally
>and then ftp'ing the script file over to the UNIX box.
>
>Greetings
>Marc

I do sit at a Windows NT machine while editing my Perl scripts. However, I use
a reasonably decent X server on my system . . . Emacs, CPerl-mode, a bunch of
xterms . . . the only thing that could make me happier would no doubt incense
NT advocates. ;-)

When forced to use a "native" NT editor, I use NT Emacs. If I visit a file
created using the Unix EOL convention, it saves it that way. If I do the same
with a DOS/NT file, it saves it using the DOS/NT convention. And if I'm
NFS-connected, toggle-buffer-file-type lets me save in whatever EOL format is
required.

And I can still use FTP if I *want* to (with ange-ftp for NT Emacs it's only
marginally more difficult than saving a local file) . . . so it _is_ an option.

:-)

But chomp() was the topic under discussion . . .

-- 
                               Jeffrey R. Drumm, Systems Integration Specialist
                       Maine Medical Center - Medical Information Systems Group
                                                            drummj@mail.mmc.org
"Broken? Hell no! Uniquely implemented!" - me


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

Date: Wed, 15 Jul 1998 10:11:05 -0400
From: "Steven E. Lipson" <selipson@computercoach.com>
Subject: Custom Programming Job
Message-Id: <6oidfr$l2f$1@news.icanect.net>

Hi,

I need to have a CGI program written that will read a text file of URL's and
submit them to various search engines automatically.

We already use one that will submit to all of the major search engines
automatically, but it requires manually typing in the URL for each page that
we're submitting.  The idea would be to either create a new program, or
modify this existing program so that it can read a text file and do this
without someone having to sit at the keyboard and type all day.

If there's someone out there that can do this for us, please email me at:
selipson@computercoach.com, or call me at my office number below to discuss
rates, etc...

Thanks

Steve

Steven E. Lipson
President
Computer Coach, Inc.
http://www.computercoach.com
Voice: (561) 483-0140
Fax: (561) 483-7773





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

Date: Wed, 15 Jul 1998 14:03:55 GMT
From: merzky@physik.hu-berlin.de
Subject: Re: Editing files
Message-Id: <6oicsb$hbr$1@nnrp1.dejanews.com>

In article <6oi70h$8u9$1@nnrp1.dejanews.com>,
  tim221175@my-dejanews.com wrote:
>  Is there an easy way of editing a file. I want to append a line of text in
> the middle of a text file. Will I have to cut the file in two halves and then
> concatenate them with new line in the middle or is there an easy way to do
> this in perl?
>
> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum
>

something like this could do the job:

#!/usr/bin/perl -w

use strict;

my ($linenumber) = 12;           # the line to be edited
my ($infile)     = "halli.in";
my ($outfile)    = "hallo.out";
my (@contents);

open (IN,  "<$infile")  || die "no infile? : $!\n";
open (OUT, ">$outfile") || die "no permissions? : $!\n";

@contents = <IN>;  # now we have a field of lines...
close (IN);

# edit line 12: replace all hallo's by ballo's:
$contents[$linenumber] =~ s/hallo/ballo/;

# append a line to line 12:
$contents[$linenumber] .= "new line iserted here...\n";

# print to outfile:
printf (OUT @contents);
close (OUT);

thats it I think..:-)
If you wonna edit any line having a certain pattern (the usual case),
try:

# fo all lines
foreach $line (@contents) {

#    thi one?
   if ($line =~ /pattern/) {

      # do the stuff...
      $line .= "new line inserted...\n";
   }

# done...

HtH, Andre.
--
Andre Merzky
pinocchio@earthling.net
http://pino.home.pages.de/

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Wed, 15 Jul 1998 07:36:34 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Editing files
Message-Id: <MPG.10165e5158245f85989746@nntp.hpl.hp.com>

In article <6oi70h$8u9$1@nnrp1.dejanews.com> on Wed, 15 Jul 1998 12:23:45 
GMT, tim221175@my-dejanews.com <tim221175@my-dejanews.com> says...
>  Is there an easy way of editing a file. I want to append a line of text in
> the middle of a text file. Will I have to cut the file in two halves and then
> concatenate them with new line in the middle or is there an easy way to do
> this in perl?

I'd read perfaq5: "How do I change one line in a file/delete a line in a 
file/insert a line in the middle of a file/append to the beginning of a 
file?"
 
-- 
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 15 Jul 1998 10:28:40 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: efficiency: print<<"xxx" vs. print
Message-Id: <6oieao$b4a$1@monet.op.net>


In article <Pine.BSF.3.96.980715014131.9619J-100000@dillinger.io.com>,
REUBEN LOGSDON  <rlogsdon@io.com> wrote:
>I think the big difference is using print <<'xxx' versus print <<"xxx".
>Single quotes are faster and if you have a block of text with one little
>variable substitution in it then you have to use doubles so you get a hit.

<< is not for efficiency.  It is for readability.

In my opinion, the readability gain is much larger and heavier than
the tiny speed loss.



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

Date: Wed, 15 Jul 1998 15:20:04 GMT
From: Scott.L.Erickson@HealthPartners.com (Scott Erickson)
Subject: Re: Globbing from a list
Message-Id: <35acc7be.6496501@news.mr.net>

Previously, Rob Hutchings <dlaser@ermine.ox.ac.uk> wrote:

>...why not do it the easy way:
>
>$regex = "^\Q$pattern\E\$";
>$regex =~ s/\\\*/.*/g;
>
>That makes it easy to add any other special cases.

Thank you Rob! I like the suggestion and have implemented it. I am
sorry I have been slow with responding. I have been out of town for
the last several days and I finally have had a chance to check clpm.

I admit, it would have taken me a long time to arrive at the solution
you presented. You have helped me and I greatly appreciate it!

Scott.


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

Date: 15 Jul 1998 10:51:52 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: HTML <SELECT MULTIPLE> var to Perl script?
Message-Id: <6oifm8$b8j$1@monet.op.net>

In article <35AAB7F9.43C4@mindspring.com>,
Diane Bouska  <dbouska@mindspring.com> wrote:
>   if ($FORM{'3pointers'}) {
>      $3pointers = "$FORM{'3pointers'}";
>   }

The knowledge you may be missing here is that variable names are not
allowed to start with digits.  Try $three_pointers instead.

Also, the " in your code are superfluous, and it would probably be a
good idea to get in the habit of leaving them out:

	$three_pointers = $FORM{'3pointers'};

You're just copying the contents of a variable here; no string
construction is necessary.


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

Date: Tue, 14 Jul 1998 09:42:41 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: I am an "antispam spammer"?
Message-Id: <fl_aggie-1407980942410001@aggie.coaps.fsu.edu>

In article <35aabbb2.879906728@news.escnd1.sdca.home.com>,
do.not.reply@this.address wrote:

+ I can see that... heck, I've had a carefully-crafted email reply
+ bounce off a munged address I didn't notice once or twice.

Which means more work for various and sundry machines. Mungers are shifting
their spam fighting work to others. That's only marginally less offensive
than spammers who shift their advertising costs to others.

James - either way, someone else pays


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

Date: Wed, 15 Jul 1998 11:09:45 -0400
From: Any more mini-dilemmas I should know about? <jefpin@bergen.org>
To: miko@idocs.com
Subject: Re: inconstant behavior of constants
Message-Id: <Pine.SGI.4.00.9807151103260.12429-100000@vangogh.bergen.org>

>--- start code snip --------------------------------------------------
>#!/usr/bin/perl
>use constant STARTYEAR        =>  -3;
>use constant STARTMONTH       =>  -4;
>use constant STARTDAY         =>  -5;
>
>%myarr=();
>$myarr{STARTYEAR} = "1984";
>
>print "just constant: STARTYEAR= " . STARTYEAR . "\n";
>print "constant in associative array: $myarr{STARTYEAR}\n";
>print "associative array with hardcoded value: $myarr{-3}\n";
>print "keys:\n";
>foreach(keys %myarr)
>	{print "\t$_ = $myarr{$_}\n";}
>--- end code snip --------------------------------------------------
>
>The output looks like this:
>
>just constant: STARTYEAR= -3
>constant in associative array: 1984
>associative array with hardcoded value:
>keys:
>        STARTYEAR = 1984

ok.  Firstly, in a hash assignment, $hash{foo} => $hash{"foo"}.  Therefore,
$myarr{STARTYEAR} => $myarr{"STARTYEAR"}, which is the literal string
"STARTYEAR".  To get around that, you need to do:
	$myarr{@{[ STARTYEAR ]}} = 1984;
as messy as that may be.

Um... oh, there's no secondly.  Nevermind.  But that should fix your
constant problem.

--
I'm not laughing at you, I'm laughing with you... You're just not
laughing.
	                                            - Jeff Pinyan
-- Jeff Pinyan | users.bergen.org/%7Ejefpin | techmaster@bergen.org --
NYPM | ICQ# 10222129 | 10222129@pager.mirabilis.com | qw[jeff] on EFnet
&jp('"($``','','$)EDF8```','$*52J4```','$+E1G4```','#J``@','#2__`');sub
  jp{for$w(@_){$_=unpack('B48',unpack('u',$w));$c=~tr/10/# /;print;}}



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

Date: 15 Jul 1998 07:39:59 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Indentation
Message-Id: <m3lnpv18lc.fsf@windlord.Stanford.EDU>

Tushar Samant <scribble@pobox.com> writes:

> Hm, I guess plonking down code which looks good with 2-space tabstops in
> front of someone who uses 8-space tabstops is equally rude, now that I
> think of it. Maybe I will try spaces-only. In any case I still think
> having shiftwidths LESS than tabstops is the worst and causes weird
> outdents.

I agree with you on that one; it's a rather braindead default for emacs to
have.  Editors really should not insert tabs for anything.

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: Wed, 15 Jul 1998 09:52:19 -0400
From: "A.E. Sundstrom" <andrew@watson.ibm.com>
Subject: Nonblocking, buffered input
Message-Id: <35ACB413.C1DA6DD4@watson.ibm.com>

I wrote the following, intending to wait 10 seconds for STDIN to produce

the pattern "xxx\n", in order to exit the loop before dying.  The
essence of what I want to know is: how do I create and operate with
non-blocking, buffered input, whether it be a socket or filehandle?

$|=1;
$x = <STDIN>;
$timeStart = time();
while ($x ne "xxx\n") {
    $timeNow = time();
    if (($timeNow - $timeStart) > 10) { die; }
    $x = <STDIN>;
}
exit;

Obviously this waits until a "\n" is input, before proceeding into the
loop.  Isn't there a way to peek at the input stream to see if anything
is waiting in the buffer; otherwise, go and do something else?

I would appreciate any insight.  Thank you.

    -Andrew

--

A.E. Sundstrom             IBM Thomas J. Watson Research Center
Research Associate         Exploratory Computer Vision Group
vox: 914.784.6260          Office H1-L05, 30 Saw Mill River Road
fax: 914.784.6307          Yorktown Heights, NY  10532
<andrew@watson.ibm.com>    <www.research.ibm.com>




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

Date: Wed, 15 Jul 1998 11:12:52 -0400
From: "A.E. Sundstrom" <andrew@watson.ibm.com>
Subject: Re: Nonblocking, buffered input
Message-Id: <35ACC6F4.6E5E2276@watson.ibm.com>

I forgot to specify.  I'm running Perl 5.004_1 on WinNT 4.0.

--

A.E. Sundstrom             IBM Thomas J. Watson Research Center
Research Associate         Exploratory Computer Vision Group
vox: 914.784.6260          Office H1-L05, 30 Saw Mill River Road
fax: 914.784.6307          Yorktown Heights, NY  10532
<andrew@watson.ibm.com>    <www.research.ibm.com>




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

Date: Wed, 15 Jul 1998 07:31:53 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: passing variables by reference
Message-Id: <MPG.10165d3343abfd87989745@nntp.hpl.hp.com>

In article <35ACA496.9CF1B213@wanadoo.com> on Wed, 15 Jul 1998 14:46:14 
+0200, Eric Zylberstejn <Eric.Zylberstejn@wanadoo.com> says...
 ... 
> $" = '--';
> print "@liste1\n";
> print "@liste2\n";
> 
> 
> Incidentally, you don't need to use join() to print a list, set the $" variable
> instead.

In fact, you *do* need to use join() to print a list.  What you are doing 
above is printing an *array*, which gets expanded when interpolated 
within double-quotes into a list of its elements joined by the value of 
$".

> 	Ericbegin:          vcard
> fn:             Eric Zylberstejn
> n:              Zylberstejn;Eric
> org:            FTI
> adr:            41 r Camille Desmoulins;;;Issy-les-Moulineaux;;92130;France
> email;internet: Eric.Zylberstejn@wanadoo.com
> tel;work:       01 41 33 94 59
> x-mozilla-cpt:  ;0
> x-mozilla-html: FALSE
> version:        2.1
> end:            vcard

Please spare us all this noise in the future.

-- 
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 15 Jul 1998 08:25:32 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Perl Beautifier Home Page
Message-Id: <m3af6b16hf.fsf@windlord.Stanford.EDU>

Zenin <zenin@bawdycaste.org> writes:

> 	If you're in an 80x24 char screen, sure it's somewhat "easily
> 	recognizable".  But if you're in a larger screen (like you really,
> 	really should be if you're doing any real coding...) like the
> 	common 90x30, 120x50, etc char settings, 2 spaces might as well
> 	be nothing at all.

This is the point where I raise a cross and back away slowly while
screaming for help from a vampire hunter.

People who program in more than 80 columns aren't the incarnation of evil,
but they rank up there in the hierarchy of darkness.  ;)  Sorry, I refuse
to ever use more than 80 columns; it's harder to read.  I definitely don't
want to see code if it's more than 80 columns.  *wry look*

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: Wed, 15 Jul 1998 15:50:06 GMT
From: John Porter <jdporter@min.net>
Subject: Re: Perl Beautifier Home Page
Message-Id: <35ACD151.6F94@min.net>

Zenin wrote:
> 
>         And just to start the Holy War on a good foot, spaces suck hard
>         IMHO.  Why? Simple, they needlessly make it harder to backup an
>         expression as most editors need to hit back space for as many
>         spaces as you use for the indent(s).  Thus, to change:
> 
>                 {
>                         foo();
>                             bar();
>                 }
>         To:
>                 {
>                     foo();
>                     bar();
>                 }
> 
>         Takes 12 backspaces, instead of 3. -With tabs stops set to 4
>         spaces as they should be for coding, of course. :-)

(I'm sure I'm going to regret biting.)

"Most editors"???   As you know, popularity != quality.

How many keystrokes to undent 30 lines by one indentation level?

In vi, it's "30<<" (without quotemarks, of course).
And it uses the shiftwidth setting, which is separate from the tabstop
setting.

IMHO, tabs suck hard, especially if you're working in a multi-programmer
environment.  Each guy has his own preferences for tab width.  And
when one guy loads a file created by another guy who likes a different
tab width, it just looks like hell...   The first thing the guy does is
go and reformat the entire file so it looks good in his editor.

Also, vi will convert tab keystrokes into the appropriate number of
spaces, by default (I think).

-- 
John Porter

We have enough youth, how about a fountain of smart?


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

Date: 15 Jul 1998 11:09:51 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Perl Database Problem
Message-Id: <6oignv$be2$1@monet.op.net>
Keywords: continuity invention lice rampart


In article <6odall$gda$1@nnrp1.dejanews.com>,  <mike@2f3.com> wrote:
>It seems to work fine, returning the correct HTML, but the text file has
>nothing written to it.

1. You forgot to check for an error when you opened the file:

	open(F, $file)
	  or print "<h1>Couldn't open file `$file': $!</h1>";

2. You should read the guide to solving CGI problems, because this is
   one of the things it discusses:

	<URL:http://language.perl.com/CPAN/doc/FAQs/cgi/idiots-guide.html>



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

Date: Wed, 15 Jul 1998 09:12:08 -0600
From: "Greg Rebuck" <Gregory.Rebuck@digital.com>
Subject: Re: perl IDE and compiler
Message-Id: <6oihb0$nnj$1@nntpd2.cxo.dec.com>

stlam@yahoo.com wrote in message <6o9ohf$d2m$1@nnrp1.dejanews.com>...
>Hi all,
>Is there any Perl IDE for win32/unix?
>Is there any Perl compiler for win32/unix?
>regards,
>Stlam
>
>-----== Posted via Deja News, The Leader in Internet Discussion ==-----
>http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum

I find this a frustrating topic.  I downloaded the gzip for what appears to
be a Perl-to-C compiler from the site (shown below) but it's almost two
years old and still says "alpha 3".  Haven't tried it yet but whether it
works or not it appears to have been abandoned.  See what you think:

******************
    Announcing the Perl Compiler Kit, Version alpha3
This is alpha-test version 3 of the compiler kit for Perl.
It provides extension modules for Perl 5.002 (or newer) which
let you compile Perl programs.
New since alpha2
    CC backend now supports ".." and s//e.
    Xref backend generates cross-reference reports
    Cleanups to fix benign but irritating "-w" warnings
    Minor cxstack fix
New since alpha1
    Working CC backend
    Shared globs and pre-initialised hash support
    Some XSUB support
    Assorted bug fixes
The compiler kit is available for anonymous ftp from ftp.ox.ac.uk
in /pub/perl/Compiler-a3.tar.gz and is licensed under both the GNU
Public Licence and the Artistic Licence, just as perl itself is.
Prerequisites are perl 5.002 (or newer) and the ability to keep
calm when this alpha-test software fails to compiler your program.
Please read the README that comes with the distribution *thoroughly*
before assuming you've found a bug. Bug hunters need not worry:
there are bound to be plenty of bugs that aren't mentioned there.
Malcolm Beattie
2 September 1996
*********************




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

Date: Wed, 15 Jul 1998 17:41:46 +0200
From: Ernst Christensen <e.christensen@netjob.dk>
Subject: Perl zipping files??
Message-Id: <35ACCDBA.24F9@netjob.dk>

Hi
I have a Perl program running on a server, that produces a nummber of
html-files. My problem is to make a perlscript, that can zip theese
files.
I have tried with pkzip etc.. something like this:

system("pkzip.exe new.zip file.htm")

But (ofcource) this dosn't work, since the server can't recognize
pkzip.exe.
Any solutions (i have checked CPAN)

reg
Ernst


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

Date: Wed, 15 Jul 1998 14:13:05 GMT
From: jeff@yoak.com (Jeff Yoak)
Subject: Re: Pre-pending data to a database or file.
Message-Id: <6oid8j$gos@sjx-ixn6.ix.netcom.com>

[posted and emailed]

David Hemmer <mastered@paclink.com> wrote:

>I know that I can append information to a flatfile db or other file,

>example:
>open (DATABASE, ">>./$data");

>but is there some way to pre-pend the data to the specified file?

Please see this from the FAQ:

http://www.perl.com/CPAN-local/doc/FAQs/FAQ/PerlFAQ.html#How_do_I_change_one_line_in_a_fi

Hope this helps!

Jeff

-- 
Jeff Yoak         jeff@yoak.com



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

Date: Wed, 15 Jul 1998 07:48:57 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Pre-pending data to a database or file.
Message-Id: <MPG.1016612fe70744ac989748@nntp.hpl.hp.com>

In article <35AB0967.47CCB3C8@paclink.com> on Tue, 14 Jul 1998 00:31:51 -
0700, David Hemmer <mastered@paclink.com> says...
> I know that I can append information to a flatfile db or other file,
> 
> example:
> open (DATABASE, ">>./$data");
> 
> but is there some way to pre-pend the data to the specified file?

RTFFAQ - perlfaq5.  "How do I change one line in a file/delete a line in 
a file/insert a line in the middle of a file/append to the beginning of a 
file?"

That line was still in my clipboard (Windows talk :-) from the previous 
post.
 
-- 
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Wed, 15 Jul 1998 14:35:34 GMT
From: "Fred Fluharty" <fmfluh00@pop.uky.edu>
Subject: Re: Pre-pending data to a database or file.
Message-Id: <Ew54p8.5yn@iglou.com>

I don't think that perl provides a way to use the open command to do this.
You might consider writing to a temporary file then using a system call to
the cat command to stick this temporary file at the head of your database.


David Hemmer wrote in message <35AB0967.47CCB3C8@paclink.com>...
>I know that I can append information to a flatfile db or other file,
>
>example:
>open (DATABASE, ">>./$data");
>
>but is there some way to pre-pend the data to the specified file?
>
>Thanks
>
>Dave Hemmer
>'rainman'
>visionaryone@unforgettable.com
>Mastered Media Productions
>
>
>




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

Date: Sun, 12 Jul 1998 09:13:39 -0400
From: Bullwinkle <at@whatsamattau.edu>
Subject: Q: Changing IP address via perl
Message-Id: <35A8B682.C46C6239@whatsamattau.edu>

I routinely move my laptop between the ethernet at work and an ethernet
at home. I've got the changes needed down to just changing the IP
address and rebooting. However, it's still kludgey.

1) Is there a perl module that will let me write a script to change the
machine's IP address?
2) Any conceivable way to "restart" just the ip stack, rather than the
entire machine?

Thanks,
pete

keleher@cs.umd.edu




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

Date: Wed, 15 Jul 1998 07:45:15 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Regular expression matech for ( non-fixed number of () pairs )?
Message-Id: <MPG.1016605a42ff4320989747@nntp.hpl.hp.com>

In article <Ew4uFD.571.0.queen@torfree.net> on Wed, 15 Jul 1998 10:57:13 
GMT, Al Aab <af137@torfree.net> says...
> to  master      regular  expressions         
> to  master      sed                          
> join my         seders  informal  email  list

Does that include invitations for Passover feasts?  Count me in!!!

-- 
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Wed, 15 Jul 1998 10:13:41 -0400
From: "Mark Stang" <markstang@ncgroup.com>
Subject: Re: Remote registry editing on NT
Message-Id: <6oidoi$khm$1@usenet1.interramp.com>

Remote registry editing is a function that many administrators need to do in
an NT environment.
The only way MS provides is thru a GUI.  A scripted way would be very
useful.


Dan Nguyen wrote in message <6oic9b$19d$1@msunews.cl.msu.edu>...
>Zach Maxwell <maxwelzy@email.uc.edu> wrote:
>: Does anyone have a slick way to do remote registry manipulation
>: in PERL scripting?
>
>: Zach
>
>Wouldn't that be a security violation.  Is it over the internet, or a
network?
>
>--
>Dan Nguyen                         |
>nguyend7@cse.msu.edu               |   I am Grey.
>http://www.cps.msu.edu/~nguyend7   |
>




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

Date: 15 Jul 1998 10:24:00 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Sticking in NULL after split
Message-Id: <6oie20$b32$1@monet.op.net>

In article <Pine.SOL.3.96.980714142608.4568A-100000@corona.pmel.noaa.gov>,
Nathan Franzen  <franzen@pmel.noaa.gov> wrote:
>As I was mulling this over, Douglas Wilson's solution was the first to
>occur to me, and I wondered whether it was preferable to '1 while s///'.
>
>It's not.

I'd like to see people get out of the habit of saying `preferable to'
when all they mean is `faster than'.

They aren't the same thing.



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

Date: Wed, 15 Jul 1998 15:47:18 GMT
From: dgwilson@gte.net (Douglas Wilson)
Subject: Re: Sticking in NULL after split
Message-Id: <6oiiu3$g9e$1@news-1.news.gte.net>

On Tue, 14 Jul 1998 16:43:27 -0700, Nathan Franzen
<franzen@pmel.noaa.gov> wrote:

>On Tue, 14 Jul 1998, Douglas Wilson wrote:
>
>> On 14 Jul 1998 20:35:22 GMT, beatle@arches.uga.edu (Benjamin Dixon)
>> wrote:

>	   'substitute'=>'1 while $s=~s/,,/,NULL,/;@a=split /,/,$s',

except this one doesn't catch NULL's at the beginning of the string,
it should probably be:
$s=~s/^,|(,),/$1NULL,/

Cheers,
Douglas Wilson



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

Date: Wed, 15 Jul 1998 09:53:33 -0400
From: "Mark Stang" <markstang@ncgroup.com>
Subject: The three properties of programmers
Message-Id: <6oicip$k8m$1@usenet1.interramp.com>

I am racking my brain trying to remember the three properties of
programmers, as per the Camel book.  Alas, I do not have my copy with me.

I can remember 2 of them: laziness and hubris...please someone tell
me...what is the third?

TIA
Mark




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

Date: 15 Jul 1998 14:15:39 GMT
From: tina@scandinaviaonline.se (Tina Marie Holmboe)
Subject: Re: The three properties of programmers
Message-Id: <6oidib$cks$2@news1.sol.no>

In article <6oicip$k8m$1@usenet1.interramp.com>,
	"Mark Stang" <markstang@ncgroup.com> writes:

> I can remember 2 of them: laziness and hubris...please someone tell
> me...what is the third?

  Why, the ability to spell Randal's name correctly, of course >:)



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

Date: 15 Jul 1998 16:25:27 +0200
From: Piers Cawley <pdcawley@bofh.org.uk>
Subject: Re: The three properties of programmers
Message-Id: <s7p3ec3ur6w.fsf@serinde.elsevier.nl>

"Mark Stang" <markstang@ncgroup.com> writes:

> I am racking my brain trying to remember the three properties of
> programmers, as per the Camel book.  Alas, I do not have my copy with me.
> 
> I can remember 2 of them: laziness and hubris...please someone tell
> me...what is the third?

So, rather than wait 'til you got to where your books were you got
impatient and asked the 'net instead. Good call, not only are you too
lazy to check the references yourself but you have sufficient hubris
to think that everyone else would be interested.

-- 
Piers Cawley
Where is the life we have lost in living?
Where is the wisdom we have lost in knowledge? 
Where is the knowledge we have lost in information? -- T. S. Eliot. 


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

Date: 15 Jul 1998 10:34:37 -0500
From: Quentin  Fennessy <quentin.fennessy@amd.com>
Subject: Re: The three properties of programmers
Message-Id: <ximd8b72kmq.fsf@shaddam.amd.com>

>>>>> "Mark" == Mark Stang <markstang@ncgroup.com> writes:

    Mark> I am racking my brain trying to remember the three
    Mark> properties of programmers, as per the Camel book.  Alas, I
    Mark> do not have my copy with me.

    Mark> I can remember 2 of them: laziness and hubris...please
    Mark> someone tell me...what is the third?

Impatience.  See perl(1).  This is often well illustrated
in CLPM.

-- 
Quentin Fennessy			AMD, Austin Texas
Secret hacker rule #11 - hackers read manuals


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

Date: Wed, 15 Jul 98 16:48:25 gmt
From: ws97-868@wsrz1.wiso.uni-erlangen.de (Franz Kaufmann)
Subject: Unwanted reference after variable assignement
Message-Id: <6oifgn$dvl$1@rznews.rrze.uni-erlangen.de>

Hello.

I 4m working on a programme that reads a delimited ascii file and returns 
a 2d array containing the file content.

I create this array with something like that:

	$array[$linecoord][$rowcoord]=<STUFF>

Althought I never use any reference in my code,the output of "print 
@array" looks like the output of a "print" on a reference:

ARRAY(x489548945)ARRAY(x3427823) or something like that.

What is the reason for this and how can I make a "print @array" look like 
this :

	([0,2,3,"Hello"],[6545,"93939","m"] a.s.o )

Thank you in advance.



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

Date: Wed, 15 Jul 1998 11:18:20 EDT
From: dblack@saturn.superlink.net (David A. Black)
Subject: Re: Unwanted reference after variable assignement
Message-Id: <6oih7s$5h5$1@earth.superlink.net>

Hello -

ws97-868@wsrz1.wiso.uni-erlangen.de (Franz Kaufmann) writes:

>Hello.

>I 4m working on a programme that reads a delimited ascii file and returns 
>a 2d array containing the file content.

>I create this array with something like that:

>	$array[$linecoord][$rowcoord]=<STUFF>

>Althought I never use any reference in my code,the output of "print 
>@array" looks like the output of a "print" on a reference:

>ARRAY(x489548945)ARRAY(x3427823) or something like that.

>What is the reason for this and how can I make a "print @array" look like 
>this :

>	([0,2,3,"Hello"],[6545,"93939","m"] a.s.o )


@array is an array each of whose elements is an array reference.  That's
how Perl implements multi-dimensional arrays.

So, $array[$x][$y] means:  element number $y of the anonymous array to
which element number $x of @array contains a reference.  It is actually
an alternate form of $array[$x]->[$y].

See perlref.

As for the printout appearance - that should be easy, now :-)


David Black
dblack@saturn.superlink.net


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

Date: Wed, 15 Jul 1998 16:32:09 +0200
From: "Freddy" <fgueant@orka-intl.com>
Subject: working on /etc/passwd in a multi-user env.
Message-Id: <6oiek2$9gf$1@platane.wanadoo.fr>

Hi!
I want to write a script that edit /etc/passwd and/or /etc/shadow, but this
script is going
to be called by a http way... it mean two users can send this script, but i
want the two
to modify the file, one after the other, in their order of appearance...
how can i manage it? i'm working on redhat4.2 with perl5.002 (or 3, or 4,
don't remember..)
thank you for helping me... scalp@orka.fr





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

Date: 12 Jul 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 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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

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