[11142] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4743 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jan 25 12:57:17 1999

Date: Mon, 25 Jan 99 09:01:31 -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           Mon, 25 Jan 1999     Volume: 8 Number: 4743

Today's topics:
    Re: Perl Criticism (I R A Aggie)
    Re: Perl Criticism (Andrew M. Langmead)
    Re: Perl Criticism <james.b.crigler@lmco.com>
    Re: Perl Criticism droby@copyright.com
    Re: Perl Criticism (Larry Rosler)
    Re: Perl Criticism (I R A Aggie)
        Q: How to fix up shebang line from makefile? <dwc3q@cs.virginia.edu>
    Re: Q: How to fix up shebang line from makefile? (Sean McAfee)
        Q: how to use Filter:decrypt? <jingang@cyberway.com.sg>
        Segmentation fault using DBI/DBD w/5.004_04 <martin.tvb@digital-marketing.de>
        stat() interpretation jimrsmith@unn.unisys.com
        Statistics for comp.lang.perl.misc <gbacon@cs.uah.edu>
        sysread.... /n help????? (Gigatron)
    Re: sysread.... /n help????? (Mike Stok)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Mon, 25 Jan 1999 09:33:15 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Perl Criticism
Message-Id: <fl_aggie-2501990933150001@aggie.coaps.fsu.edu>

In article <78gq6h$qq2$1@nnrp1.dejanews.com>, topmind@technologist.com wrote:

+ In article <fl_aggie-2401991214540001@aggie.coaps.fsu.edu>,
+   fl_aggie@thepentagon.com (I R A Aggie) wrote:

+ > Because it allows you to express beauty in your code? topmind would likely
+ > ban Perl Poetry.

+ "express beauty in your code?"  Exactly what is that?

You've never _really_ coded in perl, have you? beyond, say, a 'Learning Perl'
level?

+ Is that a selling point in your Perl brochure?

It is if there's more to your life than the bottom line.

+ "How will that help my bottom line?" a manager may ask.

Happy, contented employees always help the bottom line. But that's an
alien concept to much of management in the first place.
 
+ I am not for banning, BTW. You are trying to paint me as
+ an Orwellian villian.

I'm just taking what you say at face-value. You have stated that you'd
like to "simplify" perl, haven't you, and eliminate the TMWTDI approach?

James


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

Date: Mon, 25 Jan 1999 15:02:42 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Perl Criticism
Message-Id: <F64F4I.At0@world.std.com>

Uri Guttman <uri@home.sysarch.com> writes:

>an excellent essay on choice in perl. i use all 3 styles (and others too
>like ||, &&) depending on my needs to express what is important and what
>is not. 

A couple of times I've posted articles that propose that one of the
reasons perl has so many ways to perform each action is that some of
them have horrendous overhead. When Perl gives a psychological
motivation to use "if EXPR" or "EXPR || EXPR", its partly because "if
(EXPR) BLOCK" used to be so expensive. (There are some optimizations
now that remove the BLOCK overhead when the contents of the BLOCK are
simple.)

Instead of making lots of effort in compiler/interpreter
optimizations, it instead gives multiple implementations to the same
basic programming construct, and the syntax leads the programmer
(hopefully) to the simple ones.
-- 
Andrew Langmead


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

Date: Mon, 25 Jan 1999 09:57:47 -0500
From: James B Crigler <james.b.crigler@lmco.com>
Subject: Re: Perl Criticism
Message-Id: <36AC866B.C8A52FB5@lmco.com>

Gregory Snow wrote this:

>Here is my answer to your challange:

>  open(IN, "myfile.dat") || die "unable to open myfile.dat: $!\n";
> 
>Your alternative would be something like:
> 
>  if( !open(IN, "myfile.dat") ){
>    die "unable to open myfile.dat: $!\n";
>  }

Bart Lateur replied with these comments:

> This is one of my favorite examples too. The second solution (let's call
> it "the C-like version") feels patricularily awkward, because it puts
> the stress on the "if". The fact that it opens a file, is a mere side
> effect which could just a well be ignored. Well, that what it looks
> like.

Not to make TOO much trouble, but ...
In C you CAN do this:

  ($fh = fopen(filename, "r")) || (printf(STDERR, "Can't open %s\n",
filename), exit(1));

It's just that most C programmers don't.

[change subject]

With reference to explaining topmind, it occurs to me that there's more
than one way to do it (I think the following are mutually exclusive):

1.  topmind is a CS grad student or professor who has a rigid,
inflexible
    point of view and suffers from hardening of the categories.
2.  topmind is Larry Wall looking for legitimate holes in the Perl.
3.  (less likely) topmind is Larry Wall trolling for complements on his
    creation.

I think options 2 and 3 are unlikely, since LW's archived posts show
that
his spelling and grammar are better than topmind's.  But I digress.

Here is a true statement:  topmind has plenty of hubris: witness this
quote from http://www.geocities.com/SiliconValley/Lab/6888/ (titled
"Programming Wisdom Center", it's one level up from the language
criticism page):

                       By the Galileo of Programming 
 (the only dude with enough arrogance and smarts to fix the computer
world!) 
                          Death to Unproven Fads! 

Unless and until topmind is pleased to reveal his/her/whatever identity,
we probably won't find out.
-- 
Jim Crigler                 | james.b.crigler@lmco.com
Zone 0100                   | Voice: (770)494-4528
86 S. Cobb Dr.              | "Time changes everything but truth."
Marietta GA 30063           | -- Jan Krist


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

Date: Mon, 25 Jan 1999 15:08:57 GMT
From: droby@copyright.com
Subject: Re: Perl Criticism
Message-Id: <78i1e1$m8v$1@nnrp1.dejanews.com>

In article <78bb49$p3$1@nnrp1.dejanews.com>,
  topmind@technologist.com wrote:

> Because I am looking at its plus/minuses from a different
> perspective than most of you are. I don't expect to
> "convert" you anyhow. I am only providing alternative
> views for the less religious that may pass by.
>

We're not as religious as you think.  Honest, thoughtful criticisms are
welcome.  There have been criticisms of some of Perl's quirks posted here by
some of the very people you view as religious Perl devotees.

> > It's possible to write unmaintainable code in any language.
>
> If I hear this flippen' MYTH stated one more time, I am going to
> have Norton classify Perl as a virus.
>

It's certainly not a myth.

> ALL
> LANGUAGES
> ARE
> NOT
> EQUALLY
> ABUSABLE
> !!!!!!!
>
> I am not going to explain it again.
>

You needn't.  We understand your point and disagree on its importance.

Yes, Perl lends itself well to obfuscation.  If this is done in production
code, it's a management problem.

Yes, there are "gotchas", many of them more subtle than any you've pointed
out. This certainly does mean that a novice may stumble when his code doen't
do what he expects.  Debugging is an important skill for this novice to
learn.	If he stumbles over things like the confusion between '=' and '=='
very long, he's not cut out for this profession.  Some of the others are more
difficult, and trip up the experts occasionally.  There are ways to limit the
damage (-w, use strict).

If you want to created an idiot-proof language, enjoy.	Once you've created
it, I think the true idiots will find a way around any idiot-proofing you do.

So will the geniuses (if they bother).	I'm sure a table control structure
could be used to make some really obscure code.  Define your language,
implement it, and see what sigs get written.

--
Don Roby

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


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

Date: Mon, 25 Jan 1999 08:23:28 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Perl Criticism
Message-Id: <MPG.11163a57680b72a99899c1@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <36AC866B.C8A52FB5@lmco.com> on Mon, 25 Jan 1999 09:57:47 -
0500, James B Crigler <james.b.crigler@lmco.com> says...
 ...
> Not to make TOO much trouble, but ...
> In C you CAN do this:
> 
>   ($fh = fopen(filename, "r")) || (printf(STDERR, "Can't open %s\n",
> filename), exit(1));
> 
> It's just that most C programmers don't.

For the sake of truth, every snippet posted here should be tested, even 
if it is written in a language other than Perl.  After correcting three 
errors in your one line of code, I compiled the following program:

#include <stdio.h>
#include <stdlib.h>

main( )
{
    FILE *fp;
    char *filename = "foo";

    (fp = fopen(filename, "r")) ||
        (fprintf(stderr, "Can't open %s\n", filename), exit(1));
}

And I got the following diagnostics:

CC: "try.c", line 10: error:  void  operand for  || (1428)
CC: "try.c", line 10: warning: result of || expression not used (106)

Perhaps the reason "most C programmers don't" use this locution is that 
it doesn't work (the C concept of the short-circuit operators is quite 
different from that of Perl).

And perhaps people who don't know C shouldn't post assertions about it 
here.
          
-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Mon, 25 Jan 1999 11:28:05 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Perl Criticism
Message-Id: <fl_aggie-2501991128050001@aggie.coaps.fsu.edu>

In article <78i1e1$m8v$1@nnrp1.dejanews.com>, droby@copyright.com wrote:

+ If you want to created an idiot-proof language, enjoy.  Once you've created
+ it, I think the true idiots will find a way around any idiot-proofing you do.

Don't worry, we'll just come up with more ingenious idiots!

James


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

Date: Mon, 25 Jan 1999 09:22:36 -0500
From: David Coppit <dwc3q@cs.virginia.edu>
Subject: Q: How to fix up shebang line from makefile?
Message-Id: <Pine.WNT.4.05.9901250918550.-127272089-100000@juggernaut>


This is what I've been doing in the makefile, after installation
completes:
perl -i.bak -p -e "s|^#!\S*perl|#!$(FULLPERL)|" $(INSTALLSCRIPT)/script

This works great on the Unix variants. The problem is that FULLPERL is
"C:\PERL\BIN\PERL.EXE" in Windows, which gets interpreted as
"C:PERLBINPERL.EXE" before execution of the command in the makefile.

How can I get perl to report c:/perl/bin/perl.exe instead? Or,
alternatively, how can I escape the backslashes in the makefile variable
FULLPERL?

Thanks,
David

________________________________________________________________________
David Coppit - Graduate Student        coppit@cs.virginia.edu
The University of Virginia             http://www.cs.virginia.edu/~dwc3q
                "For I am a Bear of Very Little Brain,
             and long words Bother me" - Winnie the Pooh



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

Date: Mon, 25 Jan 1999 15:42:46 GMT
From: mcafee@waits.facilities.med.umich.edu (Sean McAfee)
Subject: Re: Q: How to fix up shebang line from makefile?
Message-Id: <Wh0r2.3851$Ge3.16692148@news.itd.umich.edu>

In article <Pine.WNT.4.05.9901250918550.-127272089-100000@juggernaut>,
David Coppit  <dwc3q@cs.virginia.edu> wrote:
>This is what I've been doing in the makefile, after installation
>completes:
>perl -i.bak -p -e "s|^#!\S*perl|#!$(FULLPERL)|" $(INSTALLSCRIPT)/script

>This works great on the Unix variants. The problem is that FULLPERL is
>"C:\PERL\BIN\PERL.EXE" in Windows, which gets interpreted as
>"C:PERLBINPERL.EXE" before execution of the command in the makefile.

>How can I get perl to report c:/perl/bin/perl.exe instead? Or,

perl -i.bak -pe "BEGIN { (\$FP = '$(FULLPERL)') =~ tr|\\\\|/| } s|^#\!\S*perl|#\!\$FP|" $(INSTALLSCRIPT)/script

I got the escaping right for a shell; some tweaking may be necessary for
a Makefile.

>alternatively, how can I escape the backslashes in the makefile variable
>FULLPERL?

Replace the contents of the BEGIN block with this:

(\$FP = '$(FULLPERL)') =~ s/\\\\/\\\\\\\\/g

-- 
Sean McAfee | GS d->-- s+++: a26 C++ US+++$ P+++ L++ E- W+ N++ |
            | K w--- O? M V-- PS+ PE Y+ PGP?>++ t+() 5++ X+ R+ | mcafee@
            | tv+ b++ DI++ D+ G e++>++++ h- r y+>++**          | umich.edu


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

Date: Mon, 25 Jan 1999 23:30:30 +0800
From: "Jin.G" <jingang@cyberway.com.sg>
Subject: Q: how to use Filter:decrypt?
Message-Id: <36ac8e23.0@news.cyberway.com.sg>

Hi,

how do I encrypt my perl script, and use Filter:decrypt module to decrypt it
on-the-fly?
can anyone show me some sample codes?

Thanks,





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

Date: 25 Jan 1999 16:33:13 GMT
From: Martin Treusch von Buttlar <martin.tvb@digital-marketing.de>
Subject: Segmentation fault using DBI/DBD w/5.004_04
Message-Id: <78i6c9$p0p$1@news.rz.uni-karlsruhe.de>

Hi,

I have a strange problem using DBI/DBD: Using our company server (Linux
2.036 w/5.004_04) perl generates a segfault. On my development box
however perl restarts the subroutine 3 times and then everything=B4s fine
(Linux 2.1.124 w/5.005_02).
I am using several DBD modules. Currently DBD:CSV and DBD:XBase is used.
The error is always generated when calling DBI->connect.

I could not trace or debug the exact location because the debugger is=20
also affected.

TIA

Martin


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

Date: Mon, 25 Jan 1999 14:21:42 GMT
From: jimrsmith@unn.unisys.com
Subject: stat() interpretation
Message-Id: <78huld$k0h$1@nnrp1.dejanews.com>

Can you tell me how I interpret the output from:
@array = stat($filename) ;
$mode = $array[2] ;
# print $mode at this point gives a number: 16877 for a subdirectory
#                                           32742 for a file
How do I translate this to read,write, execute permissions ?

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


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

Date: 25 Jan 1999 16:08:25 GMT
From: Greg Bacon <gbacon@cs.uah.edu>
Subject: Statistics for comp.lang.perl.misc
Message-Id: <78i4tp$8e8$1@info.uah.edu>

Following is a summary of articles spanning a 7 day period,
beginning at 18 Jan 1999 16:05:56 GMT and ending at
25 Jan 1999 07:21:51 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.

Excluded Posters
================

perlfaq-suggestions\@mox\.perl\.com

Totals
======

Posters:  582
Articles: 1591 (548 with cutlined signatures)
Threads:  496
Volume generated: 2659.8 kb
    - headers:    1182.0 kb (23,427 lines)
    - bodies:     1380.0 kb (44,880 lines)
    - original:   927.1 kb (32,753 lines)
    - signatures: 96.2 kb (2,057 lines)

Original Content Rating: 0.672

Averages
========

Posts per poster: 2.7
    median: 1.0 post
    mode:   1 post - 368 posters
    s:      5.9 posts
Posts per thread: 3.2
    median: 2.0 posts
    mode:   1 post - 172 threads
    s:      5.7 posts
Message size: 1711.9 bytes
    - header:     760.7 bytes (14.7 lines)
    - body:       888.2 bytes (28.2 lines)
    - original:   596.7 bytes (20.6 lines)
    - signature:  61.9 bytes (1.3 lines)

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

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

   81   124.8 ( 60.8/ 48.7/ 43.3)  abigail@fnx.com
   52    84.8 ( 30.5/ 54.2/ 35.6)  tadmc@metronet.com (Tad McClellan)
   37    61.4 ( 23.0/ 34.4/ 19.7)  lr@hpl.hp.com (Larry Rosler)
   32    47.8 ( 26.9/ 20.9/ 12.9)  bart.lateur@skynet.be (Bart Lateur)
   31    61.4 ( 24.5/ 30.4/ 20.6)  mgjv@comdyn.com.au (Martien Verbruggen)
   30    40.9 ( 24.6/ 14.1/  9.3)  Jonathan Feinberg <jdf@pobox.com>
   28    80.9 ( 32.0/ 48.9/ 19.4)  topmind@technologist.com
   24    66.9 ( 25.4/ 38.8/ 20.7)  sholden@cs.usyd.edu.au
   24    32.3 ( 18.7/ 13.6/ 13.0)  fl_aggie@thepentagon.com (I R A Aggie)
   20    36.8 ( 17.7/ 13.9/  7.3)  rjk@linguist.dartmouth.edu (Ronald J Kimball)

These posters accounted for 22.6% of all articles.

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

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

 124.8 ( 60.8/ 48.7/ 43.3)     81  abigail@fnx.com
  84.8 ( 30.5/ 54.2/ 35.6)     52  tadmc@metronet.com (Tad McClellan)
  80.9 ( 32.0/ 48.9/ 19.4)     28  topmind@technologist.com
  66.9 ( 25.4/ 38.8/ 20.7)     24  sholden@cs.usyd.edu.au
  61.4 ( 24.5/ 30.4/ 20.6)     31  mgjv@comdyn.com.au (Martien Verbruggen)
  61.4 ( 23.0/ 34.4/ 19.7)     37  lr@hpl.hp.com (Larry Rosler)
  47.8 ( 26.9/ 20.9/ 12.9)     32  bart.lateur@skynet.be (Bart Lateur)
  40.9 ( 24.6/ 14.1/  9.3)     30  Jonathan Feinberg <jdf@pobox.com>
  36.8 ( 17.7/ 13.9/  7.3)     20  rjk@linguist.dartmouth.edu (Ronald J Kimball)
  35.6 ( 11.4/ 20.2/ 11.6)     13  Uri Guttman <uri@home.sysarch.com>

These posters accounted for 24.1% of the total volume.

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

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

1.000  (  2.0 /  2.0)      6  "Brian Thompson" <hitbyabus@mindspring.com>
1.000  (  3.0 /  3.0)     12  KernelKlink@webtv.net
0.969  (  2.4 /  2.4)      8  jamesht <jamesht@idt.net>
0.956  ( 13.0 / 13.6)     24  fl_aggie@thepentagon.com (I R A Aggie)
0.929  (  1.4 /  1.5)      6  "STONES ARE GOD!!" <Jesusisaphonygod@getreal.net>
0.888  ( 43.3 / 48.7)     81  abigail@fnx.com
0.834  (  9.7 / 11.6)      7  tchrist@mox.perl.com (Tom Christiansen)
0.795  (  6.2 /  7.8)      7  "James Richardson" <richardsonja@logica.com>
0.757  (  5.9 /  7.8)      8  "Michael D. Schleif" <mds-resource@mediaone.net>
0.755  (  1.6 /  2.1)      5  clay@panix.com (Clay Irving)

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

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

0.427  (  2.1 /  4.9)      9  "Michael Ching" <m_ching@hotmail.com>
0.404  (  1.0 /  2.5)      5  newsposter@cthulhu.demon.nl
0.398  ( 19.4 / 48.9)     28  topmind@technologist.com
0.397  (  1.4 /  3.5)      7  Kiril <spam.me@idea.co.uk>
0.357  (  1.5 /  4.1)      6  Lee Benfield <lbenfie1@nospamford.com>
0.356  (  4.2 / 11.8)     15  Eugene Sotirescu <eugene@snailgem.org>
0.355  (  2.7 /  7.7)     11  Abraham Grief <abey@hill.ucr.edu>
0.344  (  3.0 /  8.6)     16  Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
0.219  (  1.1 /  4.8)      6  Yogish Baliga <baliga@synopsys.com>
0.191  (  1.1 /  5.7)      6  iqbal <iqbal@orangenet.co.uk>

62 posters (10%) had at least five posts.

Top 10 Threads by Number of Posts
=================================

Posts  Subject
-----  -------

   95  Perl Criticism
   21  How long would the Unixes last without Perl?
   19  Perl problem :(Offline mode...
   18  "Back button" in CGI script
   16  Perl Web browser problem
   14  Newbie string question,  please help :)
   14  ancestry of perl features
   13  problem with: use module;
   13  list of hashes
   12  How to determine time?

These threads accounted for 14.8% of all articles.

Top 10 Threads by Volume
========================

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

 245.4 (107.9/130.4/ 73.2)     95  Perl Criticism
  53.9 ( 18.2/ 34.2/ 21.6)     19  Perl problem :(Offline mode...
  29.2 (  9.9/ 17.6/ 11.2)     14  ancestry of perl features
  28.8 ( 13.1/ 13.9/  8.3)     18  "Back button" in CGI script
  28.2 ( 15.8/ 11.0/  7.1)     21  How long would the Unixes last without Perl?
  26.5 ( 11.1/ 14.7/  8.0)     16  Perl Web browser problem
  26.4 (  7.4/ 18.1/ 15.3)     10  Statistics for comp.lang.perl.misc
  23.4 ( 10.9/ 11.2/  7.3)     13  list of hashes
  21.6 (  7.0/ 14.2/  7.1)      7  The Documeantion (was Re: Perl problem :(Offline mode...)
  21.5 (  6.7/ 14.3/ 11.4)      9  Example of Perl Cookie Implementation please

These threads accounted for 19.0% of the total volume.

Top 10 Threads by OCR (minimum of five posts)
==============================================

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

0.861  (  2.3/   2.6)      8  PROOF: Jesus is NOT LORD of the Sabbath!         ,: (5G`0(
0.848  ( 15.3/  18.1)     10  Statistics for comp.lang.perl.misc
0.837  (  6.6/   7.9)      8  Regular Expression Question
0.825  (  3.7/   4.5)      6  perl script error
0.822  (  2.2/   2.7)      5  How do I define a scalar name with a scalar
0.821  (  1.3/   1.6)      5  f
0.809  (  5.0/   6.2)      7  passing regexp modifiers in a scalar
0.806  (  6.1/   7.6)      7  flock
0.799  ( 11.4/  14.3)      9  Example of Perl Cookie Implementation please
0.795  (  3.8/   4.8)      5  Open File Detect

Bottom 10 Threads by OCR (minimum of five posts)
=================================================

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

0.490  (  3.3 /  6.7)      6  First line skip when reading file
0.477  (  2.8 /  6.0)      7  Yet another basic question.
0.470  (  2.9 /  6.1)     11  How to link image in Perl script ?
0.461  (  1.2 /  2.5)      5  HELP: Netscape 4.5 doesn't like text/html header from Perl script
0.445  (  3.1 /  7.0)     11  dereference entire array of array references
0.439  (  3.2 /  7.3)      8  Looking for free Web Server with CGI
0.428  (  1.4 /  3.3)      6  ok please don't shoot me for this question
0.422  (  1.8 /  4.3)      6  CC via email (Was Re: "Back button" in CGI script)
0.373  (  2.5 /  6.8)      8  File Upload.
0.369  (  2.8 /  7.6)      7  Am I wrong about Symbolic References?

91 threads (18%) had at least five posts.

Top 10 Targets for Crossposts
=============================

Articles  Newsgroup
--------  ---------

      38  comp.lang.perl.modules
      18  alt.perl
      16  comp.lang.perl
      12  alt.apocalypse
      12  alt.bible.prophecy
      12  alt.atheism
      12  alt.religion.christian
      12  alt.rock-n-roll.stones
      12  alt.christnet
       9  comp.os.linux.misc

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

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

      56  haslawww@friko7.onet.pl (Best Passwords to sex pages )
      36  "STONES ARE GOD!!" <Jesusisaphonygod@getreal.net>
      12  firewevrMAPSITNA@insync.net (erikc)
       7  Jerome O'Neil <jeromeo@atrieva.com>
       7  corliss@sinbad.net
       6  merlyn@stonehenge.com (Randal L. Schwartz)
       6  Julian Daniel <hachon@hotmail.com>
       6  "Richard" <Richard@WowMe.com>
       6  "MindSpring User" <kdp10@mindspring.com>
       6  abigail@fnx.com


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

Date: Mon, 25 Jan 1999 13:44:28 GMT
From: mikeob@itas.netnospam (Gigatron)
Subject: sysread.... /n help?????
Message-Id: <36ac73dc.3091705@news.mtt.net>


Hello All,

I would like to read one line at a time in a text file. Say I have
five lines, each line ending with /n
I will use sysread to read the text file until it finds /n 
After finding the occurance of the first /n I am confused as how to
proceed. At this point I want to take the first line data and stick it
in a scalar. 

How can perl achieve this?


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

Date: Mon, 25 Jan 1999 08:48:36 -0600
From: mike@stok.co.uk (Mike Stok)
Subject: Re: sysread.... /n help?????
Message-Id: <OFhkKHHS#GA.264@news1.texas.rr.com>

In article <36ac73dc.3091705@news.mtt.net>,
Gigatron <mikeob@itas.netnospam> wrote:

>Hello All,
>
>I would like to read one line at a time in a text file. Say I have
>five lines, each line ending with /n
>I will use sysread to read the text file until it finds /n 
>After finding the occurance of the first /n I am confused as how to
>proceed. At this point I want to take the first line data and stick it
>in a scalar. 
>
>How can perl achieve this?

If you mean the \n character at the end of each line then you might want
to look at the I/O operators in the perlop manual page, and the
description of $/ in the perlvar manual page.

The <> operator will do what you want,

  # FH is a file handle opened for reading

  while (<FH>) {
      # now we have a line from FH in $_
  }

is a typical way to read lines from a file and you can assign to a scalar
of your own like this:

  $line = <FH>;

The manual pages I mentioned and any good introductory book will cover <>
fairly early on.

Hope this helps,

Mike


-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
                                   |                   65 F3 3F 1D 27 22 B7 41
stok@colltech.com                  |            Collective Technologies (work)


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

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

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