[11915] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5515 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Apr 29 07:07:22 1999

Date: Thu, 29 Apr 99 04:00:20 -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           Thu, 29 Apr 1999     Volume: 8 Number: 5515

Today's topics:
    Re: Better way? download a file from perl <flighttime@earthlink.net>
    Re: Better way? download a file from perl (Bart Lateur)
        CGI testing <diwidjaja@ucdavis.edu>
    Re: CGI testing <c4jgurney@my-dejanews.com>
        Finding the TITLE to an HTML page <khan@prl.research.philips.com>
    Re: Finding the TITLE to an HTML page <gellyfish@gellyfish.com>
        HELP with BerkeleyDB.pm <dataadm@elfi2.rz.ruhr-uni-bochum.de>
    Re: How do i print something using perl? <nospam.newton@gmx.net>
    Re: Invalid Header ? <gellyfish@gellyfish.com>
        Looking Book <postmaster@rosinfo.koenig.su>
    Re: Looking Book <gellyfish@gellyfish.com>
    Re: Looking <gellyfish@gellyfish.com>
    Re: Looking <gellyfish@gellyfish.com>
        Need help on "hex($1)" (Jens Engelbrecht)
        Net::NNTP help? <darren@netline.net.uk>
    Re: PERL & Y2K (David Cantrell)
    Re: PERL & Y2K (David Cantrell)
    Re: Problem with Perl on Windows... <gellyfish@gellyfish.com>
        Problems with CPAN.PM - Cannot find MAKE.PM michielpeene@my-dejanews.com
    Re: stupid single quote " wipes out REST OF TEXT (Bart Lateur)
    Re: what's wrong with $x = $y or "" <nospam.newton@gmx.net>
    Re: Where can I get MAKE <dataadm@elfi2.rz.ruhr-uni-bochum.de>
        Why paranthesis change logical expression <raming@ewh.uni-hannover.de>
    Re: Why paranthesis change logical expression <jll@skynet.be>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Thu, 29 Apr 1999 01:23:24 -0700
From: Greg Lucas <flighttime@earthlink.net>
Subject: Re: Better way? download a file from perl
Message-Id: <290419990123242334%flighttime@earthlink.net>

In article <ASTV2.4532$gv5.2585@news.rdc1.sfba.home.com>, Stephen
Warren <swarren@slip.net> wrote:

> Greg Lucas <flighttime@earthlink.net> wrote in message
> news:280419990044133791%flighttime@earthlink.net...
> >   I'm trying to allow users to download a file created on the fly from
> > a script using:
> >...
> > Is there a way to name this file? right now it comes across as the name
> 
> This isn't a Perl question.....
> 
> You need to read the specification for MIME. It's in one of the RFCs. One of
> the headers (Content-Disposition, I think) allows you to specify a filename.
> 
> Is application/plain really the correct MIME type for what you're sending
> back?

 I realize the two questions were not exactyl perl specific but was
hoping to draw on the past experience that exist here. I'm using
application/plain because if I use the correct MIME type, text/plain it
will always end up in the users browser. I'm sending a simple CSV file.


Greg



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

Date: Thu, 29 Apr 1999 09:10:48 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Better way? download a file from perl
Message-Id: <372d1f5d.6861505@news.skynet.be>

Greg Lucas wrote:

>I'm trying to allow users to download a file created on the fly from
>a script using:
>print "Content-type: application/plain\n\n";
>and then a while statement that reads through the file.
>Is there a way to name this file? right now it comes across as the name
>of the script. Is there a better way to accomplish this. System calls?
>It would be nice to also be sure that the file doesn't end up in the
>user's browser.

Append the filename to use in your URL after your script name, separated
by a slash, i.e. as if the script name was a subdirectory. That's what's
the browser thinks it is. BTW you can get what was appended in your
script from the PATH_INFO environment variable. The limitation is that
you can give only ONE default filename.

And you may want to change the content-type from "text/plain" into
something else. The browser may be too tempted to just show the file
instead of downloading it. Try something like "text/csv", and I bet that
the browser will now ask the user what he wants to do with it, depending
on the "filename extension" as found in PATH_INFO.

	Bart.


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

Date: Thu, 29 Apr 1999 01:58:49 -0700
From: David <diwidjaja@ucdavis.edu>
Subject: CGI testing
Message-Id: <37281F48.CEF8CA26@ucdavis.edu>

Hi, i'm pretty new at this, but I'm just wondering, how can you test cgi
scripts without posting it on the web?  i'm using Windows NT. and
further than that, where do you put the cgi script on the server. I
always see people saying that it should be in cgi-bin (or cgi/bin ?)
directory, but where do I find the directory anyway?

Any help appreciated.
thanx,

David



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

Date: Thu, 29 Apr 1999 10:13:54 GMT
From: Jeremy Gurney <c4jgurney@my-dejanews.com>
Subject: Re: CGI testing
Message-Id: <7g9bd0$38j$1@nnrp1.dejanews.com>

In article <37281F48.CEF8CA26@ucdavis.edu>,
  David <diwidjaja@ucdavis.edu> wrote:
> Hi, i'm pretty new at this, but I'm just wondering, how can you test cgi
> scripts without posting it on the web?  i'm using Windows NT. and
> further than that, where do you put the cgi script on the server. I
> always see people saying that it should be in cgi-bin (or cgi/bin ?)
> directory, but where do I find the directory anyway?
>
> Any help appreciated.
> thanx,
>
> David

This gets asked here quite a lot.

It's fairly easy to set your machine up to test cgi scripts.

All you need to do is set up a http server on your machine e.g. PWS, Xitami,
Apache etc etc. All three of these are free. Personally I'd go for Apache
which you can obtain from www.apache.org.

To get your server up and running check the ActivePerl FAQ section on Web
Server Config (part of the Active State on-line documentation) which has
solutions for many of the common problems. (The ActivePerl FAQ also has a
section on Web programming which is worth a look if you're new at this.)

comp.infosystems.www.authoring.cgi is a good source of information on all
things cgi as is their faq at http://www.boutell.com/openfaq/cgi/ . Don't get
put off because it's not a dedicated perl news group - there are an awful lot
of perl questions asked there.

HTH,

Jeremy Gurney
SAS Programmer  |  Proteus Molecular Design Ltd.

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


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

Date: Thu, 29 Apr 1999 08:35:55 GMT
From: Geoff Khan <khan@prl.research.philips.com>
Subject: Finding the TITLE to an HTML page
Message-Id: <372819EB.77F1D1BA@prl.research.philips.com>

Hi

I'm trying to find the TITLE of a html page using v 5.001.

Using 

($title) = $_ =~ /<[tT][iI][tT][lL][eE]>([^<]*)</;

I can extract the title. The problem is that I have some html pages that
have comments in, and <title> is in a comment that comes before the real
<title> tag.

How can I perl to find the proper title tag ?

Thanks

Geoff


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

Date: 29 Apr 1999 10:16:34 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Finding the TITLE to an HTML page
Message-Id: <37282372@newsread3.dircon.co.uk>

Geoff Khan <khan@prl.research.philips.com> wrote:
> Hi
> 
> I'm trying to find the TITLE of a html page using v 5.001.
> 

I would *seriously* recommend you to upgrade.

> Using 
> 
> ($title) = $_ =~ /<[tT][iI][tT][lL][eE]>([^<]*)</;
> 
> I can extract the title. The problem is that I have some html pages that
> have comments in, and <title> is in a comment that comes before the real
> <title> tag.
> 
> How can I perl to find the proper title tag ?
> 

read perlfaq9.

Use the module HTML::HeadParser available from CPAN.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>



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

Date: Thu, 29 Apr 1999 10:03:06 +0100
From: Sebastian Ahrens <dataadm@elfi2.rz.ruhr-uni-bochum.de>
Subject: HELP with BerkeleyDB.pm
Message-Id: <3728204A.8C120804@elfi2.rz.ruhr-uni-bochum.de>

After one more day trying to fix the problems here I don4t know what to
do anymore...

This my little testscript which works under Linux, but not under
Solaris:

#!/usr/bin/perl -w

use BerkeleyDB;
use Carp;
$database = "database";

tie %data, 'BerkeleyDB::Hash',
           -Filename  => $database,
           -Flags     => DB_CREATE
          or carp("Cannot open $database");

my $count = 0;
opendir(DIR, "/home/dataadm/perls/diavolo");
foreach $direntry (readdir(DIR)){
  next unless ($direntry =~ /\.gif/);
  $count++;

  my $thisuid = time();
  $thisuid = $thisuid + $count;
  $data{$thisuid} = $direntry;
  print ("stored $thisuid...\n");
  push(@uids, $thisuid);
}
print ("Einlagern ist fettisch...\n");

untie %data;

The first time I run it everything seems to be ok, but nothing is stored
in the database (filesize is always remaining the same). If I start it
the second time, the carp() in line 7 warns me "Cannot open database".
Anyone with a suggestion how to solve the problem or how to get closer
to it?


    Thanks
        -Sebastian-





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

Date: Thu, 29 Apr 1999 11:47:26 +0200
From: "Philip 'Yes, that's my address' Newton" <nospam.newton@gmx.net>
Subject: Re: How do i print something using perl?
Message-Id: <37282AAE.84310596@gmx.net>

Stephen Warren wrote:
> 
> Philip Newton <nospam.newton@gmx.net> wrote in
> message news:3726D0B9.EF843CF@gmx.net...
> >
> > [1] reminds me of the Joyce (aka PCW8512)
> 
> Aha! So *that's* what the J is for...

Supposedly, the computer was named after Mr. Amstrad's secretary. Or
something like that. Don't tell me you had one of those things, too?

Cheers,
Philip
-- 
Don't remove anything to reply, unless you're a spammer


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

Date: 29 Apr 1999 09:29:49 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Invalid Header ?
Message-Id: <3728187d@newsread3.dircon.co.uk>

Tim Armbruster <t-armbruster@ti.com> wrote:
> Bob Trieger wrote in message <7g82bj$7bh$1@ash.prod.itd.earthlink.net>...
>>"Tim Armbruster" <t-armbruster@ti.com> wrote:
>>>It's impossible to tell what your problem is without seeing code.  Post
> some
>>>code, but trim it down to under 40 lines.
>>
>>
>>Not only did you not quote what you were replying to but you left off
>>the part apart him posting his code to the correct newsgroup and not
>>c.l.p.m
>>
> Thorsten Latka specifically mentioned the error, which was a Perl coding
> error 

I dont see anything in perldiag about 'headers' - whatever on of those might
be: Perl doesnt have them I'm pretty sure.

>       (as well as CGI).  

No only CGI - the program runs fine from the command line as the original
poster stated.  

>                         She simple forgot to produce a proper header, which
> could have been remedied had she posted code.
> 

It could have been remedied if she had read the proper documentation:

<http://hoohoo.ncsa.uiuc.edu>

<http://www.rfc-editor.org/rfc/rfc1945.txt>

<http://www.webthing.com/tutorials/cgifaq.html>

> Eric the Read had already mentioned the proper newsgroup, if her question
> had not been about Perl.
> 

The question was patently not about Perl.  But there again I have seen
your canned response to questions that very possibly do have Perl content
so your judgement is moot.

> Re: Invalid Header? is pretty self-explanatory, I think, and you obviously
> knew what I was replying to since you mentioned it in your post.
> 

Fine.  But you replied to another followup.

> Lay off or Lighten up.
> 

If you cant take the heat ...

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>



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

Date: Thu, 29 Apr 1999 13:05:28 +0300
From: "wALENITIN bALT" <postmaster@rosinfo.koenig.su>
Subject: Looking Book
Message-Id: <7g9ara$eg8@m2.etype.net>

Hi! Whare can i find a book or other teaching materials about Perl? Thanks.




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

Date: 29 Apr 1999 11:49:03 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Looking Book
Message-Id: <3728391f@newsread3.dircon.co.uk>

wALENITIN bALT <postmaster@rosinfo.koenig.su> wrote:
> Hi! Whare can i find a book or other teaching materials about Perl? Thanks.
> 
> 

<http://reference.perl.com/query.cgi?books>
<http://reference.perl.com/query.cgi?tutorials>

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>



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

Date: 29 Apr 1999 09:47:17 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Looking
Message-Id: <37281c95@newsread3.dircon.co.uk>

cindycrawford@my-dejanews.com wrote:
> http://cgi-shop.com
> you will find there a lot of free cgi scripts
> 

Cindy, its fine that you might post once but it begins to wear a little
thin when posted in response to every question of this type.  Anyhow
there doesnt appear to be a script on the site that does what they
wanted anyhow.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>



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

Date: 29 Apr 1999 10:14:02 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Looking
Message-Id: <372822da@newsread3.dircon.co.uk>

James Nessen <nessenj@ns.net> wrote:
> Hello,
>   I am looking for a perl script that goes through a web access_log
> and counts up the number of bytes transferred.  I am still new to
> perl, and I can't seem to find out how it's done.  If anyone can be of
> any assistance, it would be much appreciated.
> 

As they say there's got to be some thing awk is better at:)

  awk '{total = total + $NF} END {print total}' <access_log


Alternatively (and assuming you are using Apache) you could take
a look at this which could do a lot more than just count the transfers..


#!/usr/bin/perl -w

use strict;

my %by_date;

while(<>)
{
   chomp;
   if(m/^(\S+)\s               # Host
        (\S*)\s(\S*)\s         # User ?
        \[(.*)\]\s             # Time
        "([^"]*)"\s            # Request
        (\d{3})\s              # Status
        (\d*)                  # Size of data xfered
       /x
      )
    {
      my ($date,$time) = split /:/,$4;
      $by_date{$date} += $7 if ($6 == 200); 
    }
}

foreach (keys %by_date)
{
   print "$_\t$by_date{$_}\n";
}

I have assumed that you only want to count the amount transferred for
successful requests but of course you might want to include the error
responses as well.

If this doesnt work for you you should look at the perlre manpage
whilst keeping your log format in mind.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>



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

Date: Thu, 29 Apr 1999 11:48:13 +0200
From: engelbrecht@t-online.de (Jens Engelbrecht)
Subject: Need help on "hex($1)"
Message-Id: <37282ADC.E77EDE02@dachs.de>

Hello,

the following problem occurs by trying to encode an url.

(...)
$part_of_url =~ s/[^A-Za-z0-9\s]/"%".hex($1)/eg;
(...)

=> "Use of uninitialized value at the line above"

What have I missed ?

Thanks for your help.

Jens Engelbrecht.





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

Date: Thu, 29 Apr 1999 11:12:13 +0100
From: "Darren Bentham" <darren@netline.net.uk>
Subject: Net::NNTP help?
Message-Id: <7g9bcp$c3d$1@cinnamon.nnrp.netline.net.uk>


Could someone please tell me how to use the list method in the NNTP client
class.  The documentation say "The result is a reference to a hash where the
key is a group name and each value is a reference to an array.  The elements
in this array are :- the first article number in the group, the last article
number in the group and any information flags about the group."  I would
ideally like an example of this method in use.

Many thanks in advance

Darren.


*********************************************
*   Darren  Bentham
*   Internet Content Developer & Chef
*   Netline UK
*   01254 611126
*   ICQ (34537113)
*********************************************




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

Date: Thu, 29 Apr 1999 09:32:36 GMT
From: NukeEmUp@ThePentagon.com (David Cantrell)
Subject: Re: PERL & Y2K
Message-Id: <3728256b.249215262@news.insnet.net>

On 28 Apr 1999 16:36:08 GMT, sholden@pgrad.cs.usyd.edu.au (Sam Holden)
enlightened us thusly:

>On 28 Apr 1999 15:03:11 GMT, Abigail <abigail@fnx.com> wrote:
>
>>I think you're confused. Are you saying there's nothing to be fixed in:
>>
>>     printf "The year is 19%d\n", (localtime) [5];
>
>Of course there is something to fix in that. I didn't say there wasn't
>I said (obviously badly) that since the original poster was too stupid to
>read the documnetation that comes with perl on the subject. And too stupid
>to do a simple search of the subjects of the days posts to find their answer.
>Then even if they do find a magical tool that 'scans PERL script for Y2K
>compliane' they are obviously too stupid to fix anything it finds.
>
>Thus why does it matter if such a tool exists, since the poster is 
>obviouslt too stupid to use it.

Maybe the poster has taken over responsibility for ten million lines
of code written by someone he knows to be a lackwit.  Maybe the poster
is a top-notch perler, but doesn't have enough time to go through
every single line checking for Y2K bugs.  Therefore, he asks a
perfectly reasonable question about the existence of a tool to check
the suspect scripts.  Once the tool has isolated the few hundred
suspect lines, the poster can then fix them by hand.

Methinks you didn't read the original post to closely.

[Copying newsgroup posts to me by mail is considered rude]

-- 
David Cantrell, part-time Unix/perl/SQL/java techie
                full-time chef/musician/homebrewer
                http://www.ThePentagon.com/NukeEmUp


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

Date: Thu, 29 Apr 1999 09:37:11 GMT
From: NukeEmUp@ThePentagon.com (David Cantrell)
Subject: Re: PERL & Y2K
Message-Id: <372927a5.249785572@news.insnet.net>

On Thu, 29 Apr 1999 02:40:33 GMT, Eric Bohlman <ebohlman@netcom.com>
enlightened us thusly:

>Actually, it's possible to have non-compliant code that never gets the
>system date.  For example, code that gets dates with 2-digit years as some
>sort of user input and sorts or compares them.

Indeed.  When I checked some of the older code sitting around here, I
simply searched for /19[^0]/.  Turned up a few 'false positives' but
not many.  After finding them it was simply a matter of reading the
code.

[Copying newsgroup posts to me by mail is considered rude]

-- 
David Cantrell, part-time Unix/perl/SQL/java techie
                full-time chef/musician/homebrewer
                http://www.ThePentagon.com/NukeEmUp


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

Date: 29 Apr 1999 09:40:14 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Problem with Perl on Windows...
Message-Id: <37281aee@newsread3.dircon.co.uk>

Robert Kuropkat <robert-kuropkat@home.com> wrote:
> 
> 
> I'm using the PerlMagic distribution from http://www.petes-place.com/ (not
> ActiveState's ActivePerl).  When I try a bit of code such as this:
> 
> sub Main;
> Main;
> use Date::Calc;
> sub Main {
> 	print "fred\n";
> }
> 
> 
> I get the following error:
> 
> Can't locate DynaLoader.pm in @INC (@INC contains: F:\PERL\lib .) at
> F:\PERL\lib/Date/Calc.pm line 15.
> BEGIN failed--compilation aborted at test.pl line 48.
> 
> Other tests gave a similar message about Autoloader.pm.  My system does not
> seem to have either DynaLoader.pm or Autoloader.pm, which, presumably is why
> perl "Can't locate..." it.
> 
> I know there are some differences between Unix Perl and Win32 Perl.  Is this
> one of them?  Do I have it setup incorrectly? Or am I just plain missing
> something?
> 

Yeah you are missing something from the [place you got it:

   NOTE
   This is BETA SOFTWARE, and should not be used on production machines. 
   It should only be used for non-critical applications. 


Dynaloader & Autoloader are pretty damn central to the whole shaboodle
and their abscence either through some problem with the installation
or what ever is a bug which you should report by the form provided at
the site.  Without these modules perl cannot use any others.  

In the meantime I would download and install the ActiveState version
which is well known to work.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>



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

Date: Thu, 29 Apr 1999 08:01:48 GMT
From: michielpeene@my-dejanews.com
Subject: Problems with CPAN.PM - Cannot find MAKE.PM
Message-Id: <7g93lb$t2o$1@nnrp1.dejanews.com>

Hello,

Is there anybody who can tell me where I can find a MAKE program to install
Perl modules. I've installed PMAKE version 1.00 but it doesn't seem to work.
The installation was good, but when I use it with CPAN ( I use CPAN to
install
new modules by typing: "perl -MCPAN -e shell", and then "install package")
it says
it doesn't find make.pm in @INC. Is there a normal executable MAKE program
or
do I have to use the perl module pmake.
Please help, because I'm totaly stuck with it!

Thanks in advnance, Michiel

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


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

Date: Thu, 29 Apr 1999 08:00:31 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: stupid single quote " wipes out REST OF TEXT
Message-Id: <372b0d77.2279607@news.skynet.be>

NOSPAMcrstlblu@planet.eon.net wrote:

>        $content=~ s/"/&quot;/d;   > > TRIED YOUR IDEA HERE AND GOT AN ERROR

That "d" must be a "g" (as in "global": ALL occurences of '"' are
replaced).

	$content=~ s/"/&quot;/g;

	Bart.


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

Date: Thu, 29 Apr 1999 12:32:50 +0200
From: "Philip 'Yes, that's my address' Newton" <nospam.newton@gmx.net>
Subject: Re: what's wrong with $x = $y or ""
Message-Id: <37283552.87610075@gmx.net>

Abigail wrote:
> 
> Philip Newton (nospam.newton@gmx.net) wrote on MMLXVI
> September MCMXCIII in <URL:news:3726E92B.F259BE35@gmx.net>:
> // Abigail wrote:
> // >
> // > Now if only we had the ?? operator....
> //
> // What would this operator do? Logical ?: or something?
> 
> EXPR1 ?? EXPR2 would be EXPR1 if EXPR1 is defined, EXPR2 otherwise.

That would appear to be a useful addition. But as Bart points out, it
probably couldn't be called ??.

Cheers,
Philip


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

Date: Thu, 29 Apr 1999 10:11:38 +0100
From: Sebastian Ahrens <dataadm@elfi2.rz.ruhr-uni-bochum.de>
Subject: Re: Where can I get MAKE
Message-Id: <3728224A.E384C8E8@elfi2.rz.ruhr-uni-bochum.de>

michielpeene@my-dejanews.com wrote:

> Hello,
>
> Is there anybody who can tell me where I can find a MAKE program to install
> Perl modules. I've installed PMAKE version 1.00 but it doesn't seem to work.
> The installation was good, but when I use it with CPAN ( I use CPAN to install
> new modules by typing: perl -MCPAN -e shell, and then install package) it says
> it doesn't find make.pm in @INC. Is there a normal executable MAKE program or
> do I have to use the perl module pmake.
> Please help, because I'm totaly stuck with it!
>
> Thanks in advnance, Michiel
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own

Hmm, you4re talking about Win32 don4t you?!
I thinkk nmake.exe should be your friend, it works fine for me here under NT; I
got it from somewhere, try the ftpsearch on it...


        -Sebastian-



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

Date: Thu, 29 Apr 1999 11:36:05 +0200
From: Georg Raming <raming@ewh.uni-hannover.de>
Subject: Why paranthesis change logical expression
Message-Id: <37282805.5F18055B@ewh.uni-hannover.de>

Hi, everybody!

I want to read a texfile and format in a different way. For reading I
used:

while ($line = <Fin>)
  {
    print Fout $line;
  }

and this worked quite fine. No I want to read in 5 line at once, trying
this example for 2 lines:

while (($line[0],$line[1]) = <Fin>)
  {
    print Fout $line[0] $line[1]
  }

and my problem is, that this reads in only once, and then the expression
after while gets false due to the paranthesis around $line[0...

Why? What is a better way?

Thanks for your help,	Georg
-- 
------------------------------------------------------------------------
 Georg Raming                 ---        /  /    Tel : +49 511 762-2366
 Institut f|r Elektrowdrme   /-- | /| / /--/     Fax : +49 511 762-3275
 Universitdt Hannover       /__  |/ |/ /  /
 Wilhelm-Busch-Str. 4   www : sun1.rrzn-user.uni-hannover.de/~nhmgewhw/
 D-30167 Hannover                    eMail : raming@ewh.uni-hannover.de
------------------------------------------------------------------------


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

Date: Thu, 29 Apr 1999 12:12:32 +0100
From: Jean-Louis Leroy <jll@skynet.be>
Subject: Re: Why paranthesis change logical expression
Message-Id: <VA.00000220.0455764f@godot>

In article <37282805.5F18055B@ewh.uni-hannover.de>, Georg Raming wrote:

> while ($line = <Fin>)

Scalar context: read one line.

> while (($line[0],$line[1]) = <Fin>)

List context: read all file, return a list of 'lines', assign the 2 first 
lines to $line[0] and $line[1] and drop the remaining lines.

>     print Fout $line[0] $line[1]

Syntax error: a comma is missing between $line[0] and $line[1].

Jean-Louis Leroy
http://ourworld.compuserve.com/homepages/jl_leroy



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

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

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