[16239] in Perl-Users-Digest
Perl-Users Digest, Issue: 3651 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jul 13 11:10:36 2000
Date: Thu, 13 Jul 2000 08:10:20 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <963501020-v9-i3651@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 13 Jul 2000 Volume: 9 Number: 3651
Today's topics:
Re: HOW TO FTP A FILE IN PERL SCRIPT (jason)
Re: HOW TO FTP A FILE IN PERL SCRIPT (Tad McClellan)
Interesting article on Perl security <care227@attglobal.net>
Re: Jeopardy Style (Again!) [Was: multidimensional asso (Jon Bell)
Making a Perl module <samara_biz@hotmail.com>
Re: Making a Perl module (brian d foy)
metrics again, please read the reformulated question <nkh@cpen.com>
Re: Newbies cry for help <hb@mediastudio.de>
Re: NNTP Newsgroup script problem! newsposter@cthulhu.demon.nl
Re: parsing CSV file <hb@mediastudio.de>
Re: parsing CSV file <dijon@GETRIDOFTHIS.quakeuk.com>
Re: parsing CSV file <olthoff@multiboard.com>
Re: perl vs python arun_rajappa@my-deja.com
Re: PRINTing " "" " <jboes@eoexchange.com>
Re: PRINTing " "" " <uri@sysarch.com>
Problems with Perl and AFS (was: Re:trouble compiling m <lsloan@umich.edu>
Re: sdbm record size restrictions desarollador@my-deja.com
sending files to a printer in Win32? djones@excalib.com
Shorten this code, can u ? <nyaga@hotmail.com>
Re: Shorten this code, can u ? <marc_schaefer@warwick.ac.uk>
Re: Shorten this code, can u ? (Christian Kaufhold)
Re: Shorten this code, can u ? (Christian Kaufhold)
Still wrong! <arild@langtind.no>
Re: Still wrong! <foo@bar.va>
Re: Still wrong! <cal@iamcal.com>
Re: Unique Items philhibbs@my-deja.com
Re: using @_ with subs (Just a quickie from a Perl Wann <care227@attglobal.net>
Re: Vary $" through array? <uri@sysarch.com>
Re: Whelp <tony_curtis32@yahoo.com>
Re: WHERE TO FIND NET::FTP MODULE? <mike.solomon@eps.ltd.uk>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 13 Jul 2000 12:17:22 GMT
From: elephant@squirrelgroup.com (jason)
Subject: Re: HOW TO FTP A FILE IN PERL SCRIPT
Message-Id: <MPG.13d850a345048831989693@news>
lova wrote ..
>Where Can I get the Net::FTP module from as it is not one of the standard
>Perl 5 module.
http://www.cpan.org/
--
jason -- elephant@squirrelgroup.com --
------------------------------
Date: Thu, 13 Jul 2000 08:03:41 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: HOW TO FTP A FILE IN PERL SCRIPT
Message-Id: <slrn8mrc0t.9pu.tadmc@magna.metronet.com>
On Thu, 13 Jul 2000 17:47:56 +0800, lova <nurain@singnet.com.sg> wrote:
>Where Can I get the Net::FTP module from as it is not one of the standard
^^^^^
^^^^^
>Perl 5 module.
>Kiel Stirling wrote in message <396c94db$1_2@nexus.comcen.com.au>...
>>or search cpan.org for Net::ftp which is a perl module
^^^^^^^^
^^^^^^^^
>>already setup to do it.
Use the search function there.
Please read followups before commenting on them.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 13 Jul 2000 10:58:37 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Interesting article on Perl security
Message-Id: <396DD91D.44F46A3A@attglobal.net>
A pretty interesting treatment of our favorite language. Most of the
info should be old hat to you guru's, but I think it helps to stress
the point of secure programming style.
This is a black hat hacker site, so if your company has problems with
you visiting this sort of thing, be forewarned!
http://www.phreedom.org/en/issues/Phm23%20-%20Jordan%20Dimov%20-%20Security%20Issues%20in%20Perl%20Scripts.txt
------------------------------
Date: Thu, 13 Jul 2000 12:53:02 GMT
From: jtbell@presby.edu (Jon Bell)
Subject: Re: Jeopardy Style (Again!) [Was: multidimensional associative arrays]
Message-Id: <FxMzsE.E6D@presby.edu>
In article <396C85F7.45D24FA7@Home.Com>, David Ness <DNess@Home.Com> wrote:
>
>So when you quote text of previous messages, put your comments after the
>quoted text. It is ok, I believe, to interleave comments in the quoted text,
>but the comments should follow quotes, not preceed them.
Also, it's considered a Good Thing to delete (or "trim" or "snip") quoted
material that is not relevant to your comments. One should also delete
the original poster's "signature", but not delete the "attribution line"
("So-and-so wrote:") at the beginning of the quoted text.
This usually solves the objection "but I don't want people to have to
scroll through all the stuff the other person wrote, in order to get to my
comments."
(I'm not accusing David of doing either of these, just adding these
guidelines for the sake of completeness.)
--
Jon Bell <jtbell@presby.edu> Presbyterian College
Dept. of Physics and Computer Science Clinton, South Carolina USA
[ Questions about newsgroups? Visit http://www.geocities.com/nnqweb/ ]
[ or ask in news:news.newusers.questions ]
------------------------------
Date: Thu, 13 Jul 2000 10:00:42 -0400
From: "Alex T." <samara_biz@hotmail.com>
Subject: Making a Perl module
Message-Id: <396DCB8A.CD302859@hotmail.com>
Hi,
How do I make a module in Perl?
Suppose I have two functions: funcOne and funcTwo
Then my module would look like:
package Module;
require(Exporter);
@ISA = qw(Exporter);
@EXPORT = qw(funcOne funcTwo);
sub funcOne{...}
sub funcTwp{...}
Then store this in the Module.pm file
Then when I want to use the module I would type:
use Module;
&funcOne();
&funcTwo();
Am I correct about this?
I tried something like that, but it didn't work. So I'm wondering if I'm
missing something.
Also, how do I change the value of @INC, so that I can store my module
not only in C:\Perl\lib, but in any arbitrary directory of my choice?
Thanks a lot!
Alex
------------------------------
Date: Thu, 13 Jul 2000 10:44:35 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: Making a Perl module
Message-Id: <brian-ya02408000R1307001044350001@news.panix.com>
In article <396DCB8A.CD302859@hotmail.com>, "Alex T." <samara_biz@hotmail.com> posted:
> How do I make a module in Perl?
start with h2xs and the perl man pages on module creation. :)
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Mongers <URL:http://www.perl.org/>
------------------------------
Date: Thu, 13 Jul 2000 13:50:53 +0200
From: "Nadim Khemir" <nkh@cpen.com>
Subject: metrics again, please read the reformulated question
Message-Id: <396dad1e.0@d2o68.telia.com>
>Can someone point me to some metric scripts ?
>MacCabbe
>halstead
thank to all that send me script converting inches to whatever.
The question is " Where can I find SOFTWARE Metrics ?". Mccabe conplexity,
halstead volume, fan-in-out,ELOC, ...
language used C, C++.
or some link to a C/C++ lexer,parser the rest I can manage myself.
------------------------------
Date: Thu, 13 Jul 2000 13:27:35 +0200
From: Heiko Bentrup <hb@mediastudio.de>
Subject: Re: Newbies cry for help
Message-Id: <396DA7A7.94E2FE8D@mediastudio.de>
Ecco wrote:
> Thanx, but the reason I want it in a Perl-script is; I need to create a
> profile in a chat-box that pops-up the window. It only allows limited HTML
> and NO JAVA, it does except Perl-scripts though.
>
There are 3 ways the 1st and second require JavaScript (which is NOT Java)
1. open a new window and let the script put it's output in there
i.e:
<a href="javascript: window.open('script-url', 'windowname',
'');">open new window</a>
2. call the script, print out a html page, that has an onLoad-event in
it's <BODY>-tag:
<BODY onLoad="window.open('script-url', 'windowname', '');">
and then you will be able to fill the window with any content you
want to
3. open a new window with HTML
<a href="yourscript" target="_blank">
>
> --
> -----------------------------------------------------
> Click here for Free Video!!
> http://www.gohip.com/free_video/
>
> "taboo" <taboo@doofa.net> wrote in message
> news:396c8c23$1_3@nexus.comcen.com.au...
> >
> > "Ecco" <ecco64@chello.nl> wrote:
> > >Greetings guru's! I just recently started programming with Perl, and
> I'm>looking for a script that pop-ups a new browser-window, but I have NO
> clue
> > >how to do that... Thanx 4 ur time,
> > > ~ecco~
> > >
> > >
> > try
> > <a href="somelink" target=_blank>some text</a>
> > ps this is not perl but HTML.
--
Heiko Bentrup
MediaStudio
für Marketing und Multimedia GmbH
http://www.mediastudio.de
---------------------------------
------------------------------
Date: 13 Jul 2000 14:49:05 GMT
From: newsposter@cthulhu.demon.nl
Subject: Re: NNTP Newsgroup script problem!
Message-Id: <8kkkt1$4um$1@internal-news.uu.net>
David Rugendyke <nospam@one.net.au> wrote:
> using NNTPClient module... Here's the code so far....
> print $c->article($last); = "Article Header info... text body
> etc..."
> $news = $c->article($last);
> print $news; = "ARRAY(asd98x09800)"
Check documentation of the NNTPClient module. article returns different
things depending on the context it is used in.
> I need the article in a scalar variable so I can extract the information
> using...
Have a look at xhdr, that might be more useful for you.
Erik
------------------------------
Date: Thu, 13 Jul 2000 12:12:01 +0200
From: Heiko Bentrup <hb@mediastudio.de>
Subject: Re: parsing CSV file
Message-Id: <396D95F0.DF3C12CE@mediastudio.de>
i do not know if there is a way to do this, but to avoid thos problems (yes,
i know about them) when using to CSV-files
i seperate the values using an uncommon char, that should not be in a normal
textstring. up to know the pipe ( | ) worked
fine for me. Some people tend to use the semicolon, but in some texts you
may also have that in there.
One way to solve your problem, maybe to use a regexp that looks for a comme
with a trailing space. i. e. If you have a closer look to my email, you will
find out, that i use the commas that way. Of course i cannot guarantee that
everybody does.
Nickolay wrote:
> Hello all,
>
> I am trying to parse a CSV file on a line by line basis.
> In otherwords I want to parse a line, where each field is separated with
> a
> comma. I want to store all these fields in an array.
>
> Unfortunatelly splitting the line simply by commas does not work
> since some of the field values themselves contain commas.
>
> I am new to Perl so please bear with me.
>
> Does anyone have a good reg expression that they've already come up with
>
> for this sort of parsing?
>
> Thanks for your time.
>
> -N.
--
Heiko Bentrup
MediaStudio
für Marketing und Multimedia GmbH
http://www.mediastudio.de
---------------------------------
------------------------------
Date: Thu, 13 Jul 2000 11:56:37 +0100
From: "dijon" <dijon@GETRIDOFTHIS.quakeuk.com>
Subject: Re: parsing CSV file
Message-Id: <396da09d$1_3@news1.vip.uk.com>
FYI, the following seems to be the current standard for comma seperated
files :-
any entry with commas inside the value, or spanning multiple lines, is
quoted ie;
col1name,col2name,col3name,col4name
value1,"value,2",value3,"value
4"
anything quoted with quotes in it is doublequoted, ie; value1,"value ""2""
",value3,"value4"...
from that, you should be able to come up with a CSV parser based on regular
expressions.
dan
------------------------------
Date: Thu, 13 Jul 2000 09:02:14 -0400
From: "Darryl Olthoff" <olthoff@multiboard.com>
Subject: Re: parsing CSV file
Message-Id: <8kkekl$bvg$1@panther.uwo.ca>
> I am trying to parse a CSV file on a line by line basis.
> In otherwords I want to parse a line, where each field is separated with
> a
> comma. I want to store all these fields in an array.
>
> Unfortunatelly splitting the line simply by commas does not work
> since some of the field values themselves contain commas.
>
> I am new to Perl so please bear with me.
>
> Does anyone have a good reg expression that they've already come up with
>
> for this sort of parsing?
use Text::ParseWords;
@Words = "ewords(',', 0, $Line);
------------------------------
Date: Thu, 13 Jul 2000 14:39:08 GMT
From: arun_rajappa@my-deja.com
Subject: Re: perl vs python
Message-Id: <8kkka8$fm7$1@nnrp1.deja.com>
hi,
i've worked with both perl & python. here's a simple piece of advice,
imho, which will tell you whether to use perl or python :
if you are writing an huge (read over 10000 lines of code) application
which will need to be maintained over the next 5 years, use Python.
else use Perl.
so, mostly use perl.
- arun
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 13 Jul 2000 09:54:56 -0400
From: Jeff Boes <jboes@eoexchange.com>
Subject: Re: PRINTing " "" "
Message-Id: <396dcb60$0$1493$44a10c7e@news.net-link.net>
Uri Guttman wrote:
> DS> print "$company \"some_text\" more text"; #escape the "
>
> please don't ever show that style of escaping quotes. i hate seeing it.
>
And that makes it wrong? Sorry, I'm not trying to start a flamewar here
over something this trivial, but you have to remember that probably
10-50% of the readers of this thread are non-professional programmers.
Statements like yours are going to glide right past them.
Try this:
print "foo \"bar\"";
is pretty unreadable compared to
print q(foo "bar");
Both will work, but the first example tends to cause confusion and
eyestrain among people forced to look at 100 lines of code with this
style.
Note that
print q(I've got a \("secret"\));
isn't much better, but you can always change delimiters:
print q{I've got a ("secret")};
Now, doesn't that tell you more than "I hate this"?
--
Jeff Boes |Computer science is no more |jboes@eoexchange.com
Sr. S/W Engineer |about computers than astronomy|616-381-9889 ext 18
Change Technology|is about telescopes. |616-381-4823 fax
EoExchange, Inc. | --E. W. Dijkstra |www.eoexchange.com
------------------------------
Date: Thu, 13 Jul 2000 14:18:16 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: PRINTing " "" "
Message-Id: <x7k8eqjeqf.fsf@home.sysarch.com>
>>>>> "JB" == Jeff Boes <jboes@eoexchange.com> writes:
JB> Uri Guttman wrote:
DS> print "$company \"some_text\" more text"; #escape the "
>>
>> please don't ever show that style of escaping quotes. i hate seeing it.
>>
JB> And that makes it wrong? Sorry, I'm not trying to start a flamewar here
JB> over something this trivial, but you have to remember that probably
JB> 10-50% of the readers of this thread are non-professional programmers.
i know, which is why i want to educate them in the better use of quotes.
JB> print "foo \"bar\"";
JB> is pretty unreadable compared to
JB> print q(foo "bar");
what about
print "foo 'bar'" ;
which is what i mentioned. i think it is the simplest and clearest way.
and when i debug i usually wrap the vars in [] to see if there was
anything in them like:
print "foo is [$foo]\n" ;
JB> Now, doesn't that tell you more than "I hate this"?
and i mentioned single quotes and here docs as well. so my hate comment
was not isolated. either way, i still hate seeing escaped quotes. there
is almost no reason to ever do it. backwhackis useful for escaping $ and
@ but is never needed for double quotes. there are too many good
alternatives
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Thu, 13 Jul 2000 10:50:30 -0400
From: Lance E Sloan <lsloan@umich.edu>
Subject: Problems with Perl and AFS (was: Re:trouble compiling modules)
Message-Id: <396DD736.ACD94572@umich.edu>
As it turns out, my trouble with the AFS module, and others, has been solved
by rebuilding Perl on a local drive instead of in my home directory in AFS!
I stumbled across this while trying to figure out why the installman script
that came with the 5.6.0 distribution had such trouble installing the
manpages. It would cause afsd to print all kinds of error messages like, "afs:
Lost contact with file server 130.237.227.65 in cell nada.kth.se". My perl
distribution was not in /afs/nada.kth.se nor was I trying to install the
manpages there. Debugging this, I found the culprit was the getcwd() function
from the Cwd module. Apparently, as the function attempts to build the
directory name, it steps
up to each previous directory and stats everything. So, in my case, when it
got to the level of /afs and stat'ed everything there, all heck broke loose.
So I moved my Perl distribution to a directory on a local drive and using the
same config.sh and Policy.sh as before, I rebuilt perl and installed it. This
time the manpages installed easily, as I expected. It may be important to note
that I was installing Perl into a directory in AFS. The destination directory
was not a problem.
I had completely rebuilt Perl at that point. I went back to looking at my
trouble with the AFS module and I found that the problem had gone away!
Apparently, Perl ended up being built differently (correctly) by moving it to
local disk!
I have not figured this out yet. I'm on a deadline to finish my Perl
installation along with a bunch of modules. After I'm done, I will go back and
take another look. If anybody else has seen this kind of trouble, or even
other Perl & AFS problems, please drop me a line.
PS: My news server may drop articles. If you really want to get my attention,
please email me, *in addition to* following up to this newsgroup. Thanks!
Jonathan Stowe wrote:
> On Wed, 28 Jun 2000 15:44:59 -0400 Lance E Sloan wrote:
> > I've recently installed Perl 5.6.0 on a
> > Solaris 2.6 machine. The compile and install
> > went well. However, when it came to some
> > modules, I ran into trouble.
> >
> > For example, the AFS 1.8 module. I had to
> > use the "POLLUTE=1" option when running
> > Makefile.PL and I got a few warnings during
> > compilation. I figured they're probably no
> > big deal. But when I ran "make test", I got
> > this error:
> It might be useful if you showed us the coompilation warnings - this looks
> like a problem with a library used by the module rather than with the module
> itself ...
>
> /J\
> --
> ** This space reserved for venue sponsor for yapc::Europe **
> <http://www.yapc.org/Europe/>
------------------------------
Date: Thu, 13 Jul 2000 12:34:52 GMT
From: desarollador@my-deja.com
Subject: Re: sdbm record size restrictions
Message-Id: <8kkd1b$9vm$1@nnrp1.deja.com>
In article <8kitdv$10c$7@nntp9.atl.mindspring.net>,
ebohlman@netcom.com (Eric Bohlman) wrote:
> desarollador@my-deja.com wrote:
> : I am developing a quick and dirty application on
> : NT (not my choice) and so there is no DB_File,
> : etc. for storing hash-tied data. I have read
> : that the record restriction (1K) in SDBM can be
> : modified, but I have not been able to find out
> : how. Thanks for any and all help.
>
> You can get a pre-compiled DB_File from ActiveState; that's almost
> certainly the best option.
>
>
They don't want me to install anything new on the server, if I put the
compiled DB_File in my working directory, will it find it and work?
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 13 Jul 2000 14:33:11 GMT
From: djones@excalib.com
Subject: sending files to a printer in Win32?
Message-Id: <8kkjv6$f9r$1@nnrp1.deja.com>
I've been programming perl for years on UNIX and have just recently been
asked to write a bunch of code for Win98 and NT. One problem I've run
into over and over again that I'm not sure how to send files to a
network printer on Windows. Is this even possible and if so how would I
go about doing this?
-david
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 13 Jul 2000 12:32:08 +0200
From: "JOW" <nyaga@hotmail.com>
Subject: Shorten this code, can u ?
Message-Id: <8kk5og$fk$1@yggdrasil.utfors.se>
Me and my friends have a small contest, trying to write the smallest code
fort doing this:
Making a subroutine sending in a list of words, and the word to match.
The sub should return a list of positions, where the string has been matched
in the list.
It should return -1 if no match was found.
Partly matched words does also count.
The sub should be called something like this
@foundposition=match(@wordlist,$matchword);
This is the shortest we've managed to construct so far:
sub match{$a=pop;for(@_){/$a/?push@b,$i++:$i++}@b?@b:-1}
------------------------------
Date: 13 Jul 2000 12:38:46 +0200
From: "Marc Schaefer" <marc_schaefer@warwick.ac.uk>
Subject: Re: Shorten this code, can u ?
Message-Id: <m3u2dumi15.fsf@mapgw.csv.warwick.ac.uk>
Hi JOW,
"JOW" <nyaga@hotmail.com> writes:
> This is the shortest we've managed to construct so far:
> sub match{$a=pop;for(@_){/$a/?push@b,$i++:$i++}@b?@b:-1}
Unfortunately, this works only when called for the first time,
as $i and @b are _global_ variables and thus still contain the
remains from last time's match. Changing it to
sub match{
my($a,$i,@b)=pop;for(@_){/$a/?push@b,$i++:$i++}@b?@b:-1
}
helps, but is very bad for the score ...
This is my best attempt so far:
sub match{(@_=grep$_[$_]=~/$_[-1]/,0..@_-2)?@_:-1};
Best,
Marc
------------------------------
Date: Thu, 13 Jul 2000 13:05:25 +0200
From: ch-kaufhold@gmx.de (Christian Kaufhold)
Subject: Re: Shorten this code, can u ?
Message-Id: <8kkd21$96i$1@f40-3.zfn.uni-bremen.de>
JOW <nyaga@hotmail.com> wrote:
[..]
> Making a subroutine sending in a list of words, and the word to match.
> The sub should return a list of positions, where the string has been matched
> in the list.
> It should return -1 if no match was found.
> Partly matched words does also count.
>
> The sub should be called something like this
> @foundposition=match(@wordlist,$matchword);
>
>
> This is the shortest we've managed to construct so far:
> sub match{$a=pop;for(@_){/$a/?push@b,$i++:$i++}@b?@b:-1}
This will only work once, because then the second time the method is
called, @b is not empty anymore and $i is probably wrong as well.
Here are two solutions that IMHO are more intuitive in scalar context,
they return the number of matches.
They also run under "use strict".
sub chka1{my($w,$i,@r)=(pop,0);for(@_){/$w/&&push@r,$i;$i++}
@r||!wantarray?@r:-1}
sub chka2{my($w,@r)=pop;while($_=pop){/$w/&&push@r,$#_+1}
@r||!wantarray?@r:-1}
Both methods still choke if $w eq "". This one will not:
sub chka3{my($w,@r)=pop;while($_=pop){/$w# documented?
/x&&push@r,$#_+1}@r||!wantarray?@r:-1}
This one will also protest if called without parameters at all.
sub chka4{$#_<0&¨my($w,@r)=pop;while($_=pop){/$w#
/x&&push@r,$#_+1}@r||!wantarray?@r:-1}
Christian
------------------------------
Date: Thu, 13 Jul 2000 13:21:15 +0200
From: ch-kaufhold@gmx.de (Christian Kaufhold)
Subject: Re: Shorten this code, can u ?
Message-Id: <8kkedc$c0k$1@f40-3.zfn.uni-bremen.de>
Christian Kaufhold <ch-kaufhold@gmx.de> wrote:
[...]
>
> This one will also protest if called without parameters at all.
>
sub chka4{@_||die;my($w,@r)=pop;while($_=pop){/$w#
/x&&push@r,$#_+1}@r||!wantarray?@r:-1}
Christian
------------------------------
Date: Thu, 13 Jul 2000 10:08:44 GMT
From: "langtind" <arild@langtind.no>
Subject: Still wrong!
Message-Id: <Mygb5.2694$Dxe.185703424@news.telia.no>
When I use this code:
open(FILE, "test.txt");
while ($line = <FILE>)
{
print "$line";
}
close(FILE);
print "HEI\n";
And run the script in command prompt (Linux) it prints out the content of
the file, BUT when I'm running the script through my web-page (using ISS) it
would not print the file. I can still see the "HEI".
I seem to me that EVERYTHING between while {} wouldn't come out. I don't
know what's wrong.
Trond Aage
------------------------------
Date: Thu, 13 Jul 2000 12:44:32 +0200
From: Marco Natoni <foo@bar.va>
Subject: Re: Still wrong!
Message-Id: <396D9D90.F2707561@bar.va>
Trond,
langtind wrote:
> When I use this code:
> open(FILE, "test.txt");
> while ($line = <FILE>)
> {
> print "$line";
> }
> close(FILE);
> print "HEI\n";
> And run the script in command prompt (Linux) it prints out the
> content of the file, BUT when I'm running the script through
> my web-page (using ISS) it would not print the file.
Put a check when you open the file
open FILE,"test.txt" or die "Ouch: $!";
thus you will know the reason of the problem (likely, permissions or
directory tree structure).
Best regards,
Marco
------------------------------
Date: Thu, 13 Jul 2000 15:00:57 +0100
From: "Cal Henderson" <cal@iamcal.com>
Subject: Re: Still wrong!
Message-Id: <gYjb5.361$ma3.6006@news6-win.server.ntlworld.com>
"langtind" <arild@langtind.no> wrote:
> When I use this code:
>
> open(FILE, "test.txt");
> while ($line = <FILE>)
> {
> print "$line";
> }
> close(FILE);
> print "HEI\n";
>
> And run the script in command prompt (Linux) it prints out the content of
> the file, BUT when I'm running the script through my web-page (using ISS)
it
> would not print the file. I can still see the "HEI".
> I seem to me that EVERYTHING between while {} wouldn't come out. I don't
> know what's wrong.
>
> Trond Aage
You're printing the content-type header, right?
--
Cal Henderson
sub a{my$a=reverse shift;$a=~y/b-z/a-y/;unshift@a,$a;}sub b{$c.=reverse
shift;
while(length($c)>=$b[0]){a(substr($c,0,$b[0]));$c=substr($c,$b[0]);shift@b;}
}
@b=(6,3,5,4,10,6,4,4,2,1);$a="l?jouipv"."ezvmxpbuxih";$a.=
",jofoqqibmzamsfsfxfjtuiIg";while($a ne
""){b(substr($a,0,2));$a=substr($a,2);}
print join(" ",@a);
------------------------------
Date: Thu, 13 Jul 2000 11:03:45 GMT
From: philhibbs@my-deja.com
Subject: Re: Unique Items
Message-Id: <8kk7m9$5vq$1@nnrp1.deja.com>
In article <slrn8mopts.65s.tadmc@magna.metronet.com>,
tadmc@metronet.com (Tad McClellan) wrote:
> If you want @in to remain unaffected, then don't try and
> be tricky, just be clear:
>
> my @out = grep !$saw{$_}++, @in;
> s/^/xxx/ for @out;
Yes, you're absolutely right, I was trying to run before I could walk.
However, I now understand what the code in the FAQ was doing - using a
temporary hash purely to check for duplicates before adding the
original element to a new array. Thanks to all.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 13 Jul 2000 09:52:03 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: using @_ with subs (Just a quickie from a Perl Wannabe :)
Message-Id: <396DC983.1C9F13E5@attglobal.net>
Keith Calvert Ivey wrote:
>
> Drew Simonis <care227@attglobal.net> wrote:
>
> >&error; # fine, no args thou.
> >error(); # same as above
>
> Not quite. Check perlsub. The version with & and no
> parentheses uses makes the current @_ visible to the subroutine.
> Thus, it's the same as error(@_), not error(). But that's not
> quite right, either, since the & disables prototype checking of
> arguments.
Thanks for the correction. Yet another doc for me to re-read.
(I'm bound to memorize them all sooner or later... heh... later.)
------------------------------
Date: Thu, 13 Jul 2000 14:04:34 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Vary $" through array?
Message-Id: <x7og42jfda.fsf@home.sysarch.com>
>>>>> "TB" == Tony Bowden <tony@pyxis.blackstar.co.uk> writes:
TB> Bart Lateur <bart.lateur@skynet.be> wrote:
>>> Is there any way of setting $" to a different value whilst it's printing
>>> the array?
>> No, for the simple reason that "@ary" is turned into
>> join $", @ary
>> automatically.
TB> That's what I feared.
but it would be easy to write your own (untested):
sub join_fancy (&@) {
my( $sub, @vals ) = @_
my( $string ) ;
while( @_ ) {
$string .= shift ;
$string .= $sub->() if @_ ;
}
$string ;
}
with some minor hacking, the sub can also be told how many elements are
left in @_ or become a closure with an incrementer or whatever.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: 13 Jul 2000 09:39:26 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Whelp
Message-Id: <87aefmaych.fsf@limey.hpcc.uh.edu>
>> On Thu, 13 Jul 2000 06:27:20 GMT,
>> "Ecco" <ecco64@chello.nl> said:
> K, I know it's a JAVA trick, and I know it's also
> possible to use HTML and JAVA in Perl, but HOW??? Does
> anyone have any concrete examples of the JAVA-script to
> pop-up a new browser-windows? I suck at Java even more
> than I do at Perl right now... And how exactly do you
> use it in a Perl-script??? As you probably noticed when
> I said "Newbie" I sure as hell mean "Newbie"...
perl prints out whatever you tell it to. If you print out
HTML, HTML is what you get. etc.
You won't get any javascript examples here, because this
isn't a javascript newsgroup. If you want to talk perl,
please do so, but if you want to write java/javascript
programs, there are better newsgroups for that.
(And note that "popping up a new window in the browser" is
specifically a client-side activity. From a server
running perl CGI programs (or whatever language/interface)
you can return things to browsers, but you can't force
them to do your bidding. Some browsers simply do not fit
the GUI paradigm.)
hth
t
--
"With $10,000, we'd be millionaires!"
Homer Simpson
------------------------------
Date: Thu, 13 Jul 2000 11:12:21 +0100
From: "mike solomon" <mike.solomon@eps.ltd.uk>
Subject: Re: WHERE TO FIND NET::FTP MODULE?
Message-Id: <8kk4o8$2lsfr$1@ID-36965.news.cis.dfn.de>
try
http://www.perl.com/CPAN-local/README.html
Regards
Mike Solomon
lova <nurain@singnet.com.sg> wrote in message
news:8kk335$j7c$1@violet.singnet.com.sg...
> Where Can I get the Net::FTP module from as it is not one of the standard
> Perl 5 module.
>
>
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 3651
**************************************