[13820] in Perl-Users-Digest
Perl-Users Digest, Issue: 1230 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Oct 30 09:05:21 1999
Date: Sat, 30 Oct 1999 06:05:09 -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: <941288708-v9-i1230@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sat, 30 Oct 1999 Volume: 9 Number: 1230
Today's topics:
Re: "MS VB-like" perl editor? <gellyfish@gellyfish.com>
[Perl] How to find the Perl FAQ <rootbeer&pfaq*finding*@redcat.com>
Re: adding admin feature to poll script (Abigail)
Re: AP module subroutines not available??? richardstands@my-deja.com
Re: Array reference processing (Arved Sandstrom)
Re: Array reference processing (Abigail)
Re: CGI Programming in C/C++ HELP! <gellyfish@gellyfish.com>
Re: Circular buffering (M.J.T. Guy)
Re: close() is expensive <gellyfish@gellyfish.com>
Re: close() is expensive (M.J.T. Guy)
Date::Calc problem <jamesp@sunf48.rd.bbc.co.uk>
Re: DBI prepare error when running select stmt <gellyfish@gellyfish.com>
Re: Do you now an affordable Perl editor for Windows NT <don@softwork-orange.com>
Re: How to touch a file in perl? <gellyfish@gellyfish.com>
Is Perl Underrated? <rainbow@zipworld.com.au>
Re: It is always like this here? (Abigail)
Re: length (number of items) of an array (M.J.T. Guy)
Re: open MYFILE, ">-" doesn't work in CGI? <NoSpam@JSoft.xs4all.nl>
Re: perl double-split <gellyfish@gellyfish.com>
Re: simplifying a script <gellyfish@gellyfish.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 30 Oct 1999 09:31:02 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: "MS VB-like" perl editor?
Message-Id: <7vedsm$3uq$1@gellyfish.btinternet.com>
On Fri, 29 Oct 1999 12:50:34 -0700 Andreas Falley wrote:
> Hi I'm wondering if anybody out there knows of any editor that does
> things like keeps an index
> of subroutines or methods such that you can just click on one and go to
> that part of the
> code. That was one thing I always liked about the Visual Basic
> environment...uh ...back
> when I did that sorta thing and dreamt of working for a company with a
> clue....uh before you
> start to hiss.
>
Please <http://www.perl.com/reference/query.cgi?editors> wherein are list
all manner of editors.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Sat, 30 Oct 1999 10:24:02 GMT
From: Tom Phoenix <rootbeer&pfaq*finding*@redcat.com>
Subject: [Perl] How to find the Perl FAQ
Message-Id: <pfaqmessage941279041.7162@news.teleport.com>
Archive-name: perl-faq/finding-perl-faq
Posting-Frequency: weekly
Last-modified: 18 Aug 1999
[ That "Last-modified:" date above refers to this document, not to the
Perl FAQ itself! The last major update of the Perl FAQ was in Summer of
1998; of course, ongoing updates are made as needed. ]
For most people, this URL should be all you need in order to find Perl's
Frequently Asked Questions (and answers).
http://www.cpan.org/doc/FAQs/
Please look over (but never overlook!) the FAQ and related docs before
posting anything to the comp.lang.perl.* family of newsgroups.
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
Beginning with Perl version 5.004, the Perl distribution itself includes
the Perl FAQ. If everything is pro-Perl-y installed on your system, the
FAQ will be stored alongside the rest of Perl's documentation, and one
of these commands (or your local equivalents) should let you read the FAQ.
perldoc perlfaq
man perlfaq
If a recent version of Perl is not properly installed on your system,
you should ask your system administrator or local expert to help. If you
find that a recent Perl distribution is lacking the FAQ or other important
documentation, be sure to complain to that distribution's author.
If you have a web connection, the first and foremost source for all things
Perl, including the FAQ, is the Comprehensive Perl Archive Network (CPAN).
CPAN also includes the Perl source code, pre-compiled binaries for many
platforms, and a large collection of freely usable modules, among its
560_986_526 bytes (give or take a little) of super-cool (give or take
a little) Perl resources.
http://www.cpan.org/
http://www.perl.com/CPAN/
http://www.cpan.org/doc/FAQs/FAQ/html/
http://www.perl.com/CPAN/doc/FAQs/FAQ/html/
You may wish or need to access CPAN via anonymous FTP. (Within CPAN,
you will find the FAQ in the /doc/FAQs/FAQ directory. If none of these
selected FTP sites is especially good for you, a full list of CPAN sites
is in the SITES file within CPAN.)
California ftp://ftp.cdrom.com/pub/perl/CPAN/
Texas ftp://ftp.metronet.com/pub/perl/
South Africa ftp://ftp.is.co.za/programming/perl/CPAN/
Japan ftp://ftp.dti.ad.jp/pub/lang/CPAN/
Australia ftp://cpan.topend.com.au/pub/CPAN/
Netherlands ftp://ftp.cs.ruu.nl/pub/PERL/CPAN/
Switzerland ftp://sunsite.cnlab-switch.ch/mirror/CPAN/
Chile ftp://ftp.ing.puc.cl/pub/unix/perl/CPAN/
If you have no connection to the Internet at all (so sad!) you may wish
to purchase one of the commercial Perl distributions on CD-Rom or other
media. Your local bookstore should be able to help you to find one.
Another possibility is to use one of the FTP-via-email services; for
more information on doing that, send mail to <mail-server@rtfm.mit.edu>
(not to me!) with these lines in the body of the message, flush left:
setdir usenet-by-group/news.announce.newusers
send Anonymous_FTP:_Frequently_Asked_Questions_(FAQ)_List
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
Comments and suggestions on the contents of this document
are always welcome. Please send them to the author at
<pfaq&finding*comments*@redcat.com>. Of course, comments on
the docs and FAQs mentioned here should go to their respective
maintainers.
Have fun with Perl!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 30 Oct 1999 06:14:27 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: adding admin feature to poll script
Message-Id: <slrn81lkni.66b.abigail@alexandra.delanet.com>
Paone (Paone@mediaone.net) wrote on MMCCL September MCMXCIII in
<URL:news:381A11F3.FE8C7C4B@mediaone.net>:
__ Hello, i was wondering if someone could help me add an admin feature to
__ a poll that i got off the net. I want the admin feature to edit these 2
__ parts of the script. this would be:
__ # This variable is the question you are asking in your quiz.
__ $question = "What is most important to you in a website?";
$question = "Have you bothered to read the documentation?";
__
__ # @choices represents the possible answers people can give. It should
__ # be formatted as shown.
__ @choices = ("Design","Content","I don't know");
@choices = ("Nope", "Nah", "Why should I?", "I cannot read");
__ Please e-mail me at ma1lbox@aol.com if you can help.
If you can't be bothered to read the newsgroup, it cannot be important
to you.
Abigail
--
$_ = "\x3C\x3C\x45\x4F\x54";
print if s/<<EOT/<<EOT/e;
Just another Perl Hacker
EOT
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Sat, 30 Oct 1999 12:47:26 GMT
From: richardstands@my-deja.com
Subject: Re: AP module subroutines not available???
Message-Id: <7vepcu$g41$1@nnrp1.deja.com>
In article <7vdcep$esp$1@nntp5.atl.mindspring.net>,
ebohlman@netcom.com (Eric Bohlman) wrote:
> richardstands@my-deja.com wrote:
> : #!/usr/bin/perl -w
> : BEGIN
> : {
> : unshift( @INC,"D:\\Perl\\lib" );
> : }
> : use CARP;
>
> Module names are case-sensitive, and the module you want is 'Carp'
not
> 'CARP'.
>
> : croak( "croaking" );
> : exit 1;
> :
> : Running this gave this:
> :
> : Undefined subroutine &main::croak called at test.pl line 7.
> :
> : Curiously, when I add CGI to it that part works:
>
> Of course, because the CGI module really does have an all-upper-case
name.
>
>
Yup, you are right. Working in an NT dos window I was under the
assumption that there wasn't the case sensitivity with regard to Perl
for Win32 that there is for Perl on UNIX(which is what I normally run
the scripts on). Thanks a bunch. Now I just need to find that other
module, you know the one... Green.pm with that handy method
"RemoveEggFromFace()" :o)
-Rich
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Sat, 30 Oct 1999 07:52:24 -0300
From: Arved_37@chebucto.ns.ca (Arved Sandstrom)
Subject: Re: Array reference processing
Message-Id: <Arved_37-3010990752240001@dyip-29.chebucto.ns.ca>
In article <3819ea54.258480@nntp.netcomuk.co.uk>, hw@netcomuk.co.uk (Harry
Walker) wrote:
> I create an array reference of the form
> $arrayref=\@array;
>
> I then want to pass the array reference to a subroutine and let the
> subroutine process each item in the array using a foreach loop. Is
> this possible since I cannot get this to work.
>
The array ref is coming into the subroutine as $_[0], if it's the only
parameter. In other words, @{$_[0]} gives you the original, which you can
operate on using 'foreach'.
Since it's a ref, what you do element-wise in the subroutine will affect
the original array. Hence,
#!perl -w
@myarray = (1, 2, 3, 5, 8, 13);
double(\@myarray);
print "@myarray\n";
sub double {
foreach $elm (@{$_[0]}) { $elm *= 2; }
}
__END__
prints out the doubled values. If you're using array refs you should be
anticipating this. If that's _not_ what you want, make a new arrayref
using
$newref = [ @myarray ];
or the like, populate a new list inside the sub, and return *that*.
HTH, Arved.
------------------------------
Date: 30 Oct 1999 06:14:58 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Array reference processing
Message-Id: <slrn81lkoi.66b.abigail@alexandra.delanet.com>
Harry Walker (hw@netcomuk.co.uk) wrote on MMCCLI September MCMXCIII in
<URL:news:3819ea54.258480@nntp.netcomuk.co.uk>:
:: I create an array reference of the form
:: $arrayref=\@array;
::
:: I then want to pass the array reference to a subroutine and let the
:: subroutine process each item in the array using a foreach loop. Is
:: this possible since I cannot get this to work.
Yes, it is possible.
Abigail
--
perl -MTime::JulianDay -lwe'@r=reverse(M=>(0)x99=>CM=>(0)x399=>D=>(0)x99=>CD=>(
0)x299=>C=>(0)x9=>XC=>(0)x39=>L=>(0)x9=>XL=>(0)x29=>X=>IX=>0=>0=>0=>V=>IV=>0=>0
=>I=>$r=-2449231+gm_julian_day+time);do{until($r<$#r){$_.=$r[$#r];$r-=$#r}for(;
!$r[--$#r];){}}while$r;$,="\x20";print+$_=>September=>MCMXCIII=>()'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 30 Oct 1999 09:28:01 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: CGI Programming in C/C++ HELP!
Message-Id: <7vedn1$3un$1@gellyfish.btinternet.com>
In comp.lang.perl.misc doncho <doncho@topmachine.com> wrote:
> I am currently learning CGI programming. Actually, I am not familiar with
> Perl or other languages instead of C/C++. Are there any sites, books, or
> references to learn CGI programming in C/C++, please help me.
>
Please read the CGI FAQ at <http://www.webthing.com/tutorials/cgifaq.html>
then if you have any further questions you will want to ask them in
comp.infosystems.www.authoring.cgi
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 30 Oct 1999 13:01:49 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Circular buffering
Message-Id: <7veq7t$q74$1@pegasus.csx.cam.ac.uk>
In article <slrn81f9n2.b7n.njc@dmc.uucp>, Neil Cherry <ncherry@home.net> wrote:
>On 27 Oct 1999 17:37:35 GMT, M.J.T. Guy wrote:
>>In article <slrn81bddi.36g.njc@dmc.uucp>, Neil Cherry <ncherry@home.net> wrote:
>>>I'm interested in using circular buffering in my Perl program. Does
>>>anyone have code examples of how to accomplish this?
>>
>>Use an array, say @buff, to hold the buffer.
>>
>>Then push @buff, $item; # add $item to @buff
>> my $item = shift @buff # take $item from @buff
>>
>>Contrary to what you might guess, these are efficient operations even
>>if the buffer gets large ( O(1) most of the time ), as Perl is careful
>>to avoid unnecessary shifting or copying of arrays.
>
>I see I have caused some confusion but I have gained further knowledge
>in the process. I was unaware of push/pull shift/unshift etc.
>
>What I meant by circular buffers is a fixed size array were a pointer
>points to the current position in the array to put new characters and
>a pointer that points to the last read character. I come from an
>assembly/C background and these are common in interrupt routines. I
>have to read characters from the serial port and need to send a bunch
>first then react to the characters then send a response based on the
>the characters just read.
And the moral of this is that Perl is not C (or assembler). Your
intuitions as to what is (in)efficient are liable to be severely
misleading. As a rule of thumb, if you can do something easily
in Perl (with a small number of operators), you're probably doing it
efficiently (at least by Perl's standards of efficiency ... ).
So Perl's arrays can be used as lifo or fifo buffers, more efficiently
than implementing a circular buffer "by hand". And you don't have to
worry about overflow.
Mike Guy
------------------------------
Date: 30 Oct 1999 09:38:05 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: close() is expensive
Message-Id: <7vee9t$3ut$1@gellyfish.btinternet.com>
On Fri, 29 Oct 1999 15:12:30 -0500 Peter Sakalaukus wrote:
>
> I wrote a script to parse a data file and write out 1 record at a time
> to a temporary file. Via a system() call, another program is run with
> the temporary file as the input.
>
> By removing the close OUT; statement from my code, it ran significantly
> faster. Why is close() so costly?
>
Shouldnt be, anyhow not as I noticed, close() might do extra work if you
are closing a filehandle opened as a pipe to some program and one or two
other case.
You might set $| (aka $OUTPUT_AUTOFLUSH) to see if that makes a difference,
other than that I would suggest you post the smallest working piece of code
that exhibits this behaviour.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 30 Oct 1999 12:56:00 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: close() is expensive
Message-Id: <7vept0$q0m$1@pegasus.csx.cam.ac.uk>
In article <3819FFAE.A2EECEC@ssc.usm.edu>,
Peter Sakalaukus <sakalauk@ssc.usm.edu> wrote:
>
>I wrote a script to parse a data file and write out 1 record at a time
>to a temporary file. Via a system() call, another program is run with
>the temporary file as the input.
>
>By removing the close OUT; statement from my code, it ran significantly
>faster. Why is close() so costly?
I doubt your interpretation of what is going on. The close() will
occur anyway when the script exits, so the script should take the same
time to run.
Have you checked that the "another program" is in fact receiving the
input you expect?
Do you have autoflush set on the OUT filehandle? If not, and you
don't close OUT, some (perhaps all) of the output will still be
sitting in buffers in the calling program. So the other program
will process only the first part of the data, or perhaps none at all.
I can imagine that making it a good deal faster. Perhaps you
can get away with not running the program at all. :-)
Mike Guy
------------------------------
Date: 30 Oct 1999 11:30:06 GMT
From: James Porritt <jamesp@sunf48.rd.bbc.co.uk>
Subject: Date::Calc problem
Message-Id: <7vekru$dsd$1@nntp0.reith.bbc.co.uk>
Anyone had success compiling Date::Calc on UltraSparc Solaris 7? Included
below is the results of the tests of which most failed. Comments/suggestions
welcome.
PERL_DL_NONLAZY=1 /usr/local/bin.sun4/perl5 -I./blib/arch -I./blib/lib -I/usr/local/lib/perl5/sun4-solaris/5.00404 -I/usr/local/lib/perl5 -e 'use Test::Harness qw(&runtests $verbose); $verbose=0; runtests @ARGV;' t/*.t
t/f000..............dubious
Test returned status 0 (wstat 11, 0xb)
t/f001..............dubious
Test returned status 0 (wstat 11, 0xb)
t/f002..............dubious
Test returned status 0 (wstat 11, 0xb)
t/f003..............dubious
Test returned status 0 (wstat 11, 0xb)
t/f004..............dubious
Test returned status 0 (wstat 11, 0xb)
t/f005..............dubious
Test returned status 0 (wstat 11, 0xb)
t/f006..............dubious
Test returned status 0 (wstat 11, 0xb)
t/f007..............dubious
Test returned status 0 (wstat 11, 0xb)
t/f008..............dubious
Test returned status 0 (wstat 11, 0xb)
t/f009..............dubious
Test returned status 0 (wstat 11, 0xb)
t/f010..............dubious
Test returned status 0 (wstat 11, 0xb)
t/f011..............dubious
Test returned status 0 (wstat 11, 0xb)
t/f012..............dubious
Test returned status 0 (wstat 11, 0xb)
t/f013..............dubious
Test returned status 0 (wstat 11, 0xb)
t/f014..............dubious
Test returned status 0 (wstat 11, 0xb)
t/f015..............dubious
Test returned status 0 (wstat 11, 0xb)
t/f016..............dubious
Test returned status 0 (wstat 11, 0xb)
t/f017..............dubious
Test returned status 0 (wstat 11, 0xb)
t/f018..............dubious
Test returned status 0 (wstat 11, 0xb)
t/f019..............dubious
Test returned status 0 (wstat 11, 0xb)
t/f020..............dubious
Test returned status 0 (wstat 11, 0xb)
t/f021..............dubious
Test returned status 0 (wstat 11, 0xb)
t/f022..............dubious
Test returned status 0 (wstat 11, 0xb)
t/f023..............dubious
Test returned status 0 (wstat 11, 0xb)
t/f024..............dubious
Test returned status 0 (wstat 11, 0xb)
t/f025..............dubious
Test returned status 0 (wstat 11, 0xb)
t/f026..............dubious
Test returned status 0 (wstat 11, 0xb)
t/f027..............ok
t/f028..............ok
t/f029..............dubious
Test returned status 0 (wstat 11, 0xb)
t/f030..............dubious
Test returned status 0 (wstat 11, 0xb)
t/f031..............ok
t/f032..............dubious
Test returned status 0 (wstat 11, 0xb)
t/f033..............dubious
Test returned status 0 (wstat 11, 0xb)
Failed Test Status Wstat Total Fail Failed List of failed
-------------------------------------------------------------------------------
t/f000.t 0 11 ?? ?? % ??
t/f001.t 0 11 ?? ?? % ??
t/f002.t 0 11 ?? ?? % ??
t/f003.t 0 11 ?? ?? % ??
t/f004.t 0 11 ?? ?? % ??
t/f005.t 0 11 ?? ?? % ??
t/f006.t 0 11 ?? ?? % ??
t/f007.t 0 11 ?? ?? % ??
t/f008.t 0 11 ?? ?? % ??
t/f009.t 0 11 ?? ?? % ??
t/f010.t 0 11 ?? ?? % ??
t/f011.t 0 11 ?? ?? % ??
t/f012.t 0 11 ?? ?? % ??
t/f013.t 0 11 ?? ?? % ??
t/f014.t 0 11 ?? ?? % ??
t/f015.t 0 11 ?? ?? % ??
t/f016.t 0 11 ?? ?? % ??
t/f017.t 0 11 ?? ?? % ??
t/f018.t 0 11 ?? ?? % ??
t/f019.t 0 11 ?? ?? % ??
t/f020.t 0 11 ?? ?? % ??
t/f021.t 0 11 ?? ?? % ??
t/f022.t 0 11 ?? ?? % ??
t/f023.t 0 11 ?? ?? % ??
t/f024.t 0 11 ?? ?? % ??
t/f025.t 0 11 ?? ?? % ??
t/f026.t 0 11 ?? ?? % ??
t/f029.t 0 11 ?? ?? % ??
t/f030.t 0 11 ?? ?? % ??
t/f032.t 0 11 ?? ?? % ??
t/f033.t 0 11 ?? ?? % ??
Failed 31/34 test scripts, 8.82% okay. 0/811 subtests failed, 100.00% okay.
make: *** [test_dynamic] Error 11
Cheers,
Poz.
--
James Porritt | Room B213,
Online Engineer | BBC Research and Development,
BBC R&D / Multimedia Group / | Kingswood Warren, Tadworth,
BBC Internet Services | Surrey, KT20 6NP. (01737) 839614
------------------------------
Date: 30 Oct 1999 10:39:50 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: DBI prepare error when running select stmt
Message-Id: <7vehtm$488$1@gellyfish.btinternet.com>
On Fri, 29 Oct 1999 19:44:54 GMT slicks78@my-deja.com wrote:
> I am having a prepare error returned when trying to run a SQL select
> statement to SQL Server. The SQL is dynamically generated. Some of the
> input is coming from a multi line select box w/ values appended with
> commas for parsing. I think this might be some of the problem.
>
> The code:
>
> sub getMemberID
> {
> local($sMemberIDSql, @Results,$ListofNames,$name);
>
> $ListofNames = shift;
> $ListofNames =~ s/,/','/isg;
> $ListofNames = "'" . $ListofNames . "'";
> $sMemberIDSql = qq|SELECT tblMember.MemberId FROM tblMember
> WHERE tblMember.MemberName in ($ListofNames);|;
>
> @Results = &executeSQLStatement($sMemberIDSql);
> return @Results;
> }
>
> executeSQLStatement performs a DBI prepare and execute statement and
> then returns an array of results.
>
<unmatched quote error>
$ListofNames = join ','. map { qq{'$_'} } split /,/, $ListofNames;
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Sat, 30 Oct 1999 07:30:08 -0400
From: Don Sambrook <don@softwork-orange.com>
Subject: Re: Do you now an affordable Perl editor for Windows NT
Message-Id: <381AD6C0.9929B132@softwork-orange.com>
SitePad Pro
http://www.modelworks.com
Fantastic programming editor for may languages.
Johnny 'Loopy' Ooi wrote:
> What's wrong with Notepad? ;-)
>
> --
> Johnny Ooi. Aliases: Loopy, Tuxedo Mask, Quote Master.....
> E-Mail : jjyooi@dcs.qmw.ac.uk or jjyooi@yahoo.com
> WWW : http://www.dcs.qmw.ac.uk/~jjyooi/
> ICQ No : 6155774
>
> "Stay sane guys!"
>
> ===============================================================
------------------------------
Date: 30 Oct 1999 10:44:44 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: How to touch a file in perl?
Message-Id: <7vei6s$48c$1@gellyfish.btinternet.com>
On 30 Oct 1999 06:02:18 GMT Matthew Darwin wrote:
> Well, the camel tells us now if we had just looked in the right place:
>
Sorry : *we* ? - leave *me* out of this I went straight for utime ;-}
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 30 Oct 1999 11:50:08 GMT
From: Douglas Garstang <rainbow@zipworld.com.au>
Subject: Is Perl Underrated?
Message-Id: <7vem1g$2s1$1@the-fly.zip.com.au>
(Sorry if this post has appeared a few times. You can blame Telstra for having a bodgy news
server that they refuse to fix)
Just a quick ramble...
Its my perception that perl is very much underrated as a serious tool for developing
applications (at least as far as a unix environment goes).
Would this be a true statement to make? For example, if I go to one of several I.T employment
sites and do a search on 'perl', I will always get a match of positions that are basically web
developers involving perl for CGI.
I don't recollect ever seeing any jobs advertised that involve developing some sort of
application around perl. Nothing larger than could be classified as basic system
administration anyway.
I could understand the tendancy for companies to use C before they use perl. But WHY java
(which seems quite common as a development tool)? You might hear the argument that C runs much
faster than perl (which is for the most part true), but the same most definitely does not hold
true for Java. Java is also only as portable as there is virtual machines for it, while perl
similarly is available for several different operating systems. The reasons are different, but
the end result is the same. We can't forget that perl can be OO as well.
I wonder if any of this makes sense.....!
Regards
Douglas Garstang
------------------------------
Date: 30 Oct 1999 05:52:06 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: It is always like this here?
Message-Id: <slrn81ljdm.66b.abigail@alexandra.delanet.com>
Martien Verbruggen (mgjv@wobbie.heliotrope.home) wrote on MMCCLI
September MCMXCIII in <URL:news:slrn81kri2.jvv.mgjv@wobbie.heliotrope.home>:
\\
\\
\\ Which was partly, although not explicitly stated, my point. I,
\\ personally, try to be nice to new posters. However, I don't always
\\ succeed. Most people here probrbaly try to be nice to new posters.
\\ However, they don't always succeed. And for some people the 'not always'
\\ is more often than for others.
I think the accusation of nastiness against newbies is totally
unjustified. It's simply not true. There is some flaming against people
posting off-topic questions, FAQs, badly formatted or structured questions
and a blantant lack of doing research.
While it's true that this behaviour happens more with newbies than
people longer in this group - people are not flamed for being newbies.
People are flamed for how they behave - not for what they are.
Abigail
--
perl -weprint\<\<EOT\; -eJust -eanother -ePerl -eHacker -eEOT
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 30 Oct 1999 12:04:32 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: length (number of items) of an array
Message-Id: <7vemsg$na2$1@pegasus.csx.cam.ac.uk>
Philip 'Yes, that's my address' Newton <nospam.newton@gmx.li> wrote:
>On 28 Oct 1999 14:40:09 GMT, gbacon@ruby.itsc.uah.edu (Greg Bacon)
>wrote:
>
>> return 0 if $#_ == -1;
>
>What if someone outside of your subroutine fiddles with $[ ?
Since perl5, $[ has been file-scoped. So the "someone" must be you.
And Perl always allows you the opportunity to shoot yourself in the foot.
It merelty tries to discourage you.
Mike Guy
------------------------------
Date: Sat, 30 Oct 1999 14:49:54 +0200
From: "Willem Joosten" <NoSpam@JSoft.xs4all.nl>
Subject: Re: open MYFILE, ">-" doesn't work in CGI?
Message-Id: <7vepiu$mep$1@news1.xs4all.nl>
Wyzelli <wyzelli@yahoo.com> wrote in message
news:D0rS3.12$MV2.1387@vic.nntp.telstra.net...
> You are not specifying to write to $filename.
>
> Include the > and see what happens.
>
> Also check the return value so you can see what errors occur.
>
> open (MYFILE ">$filename") or die "unable to open $filename because $!\n";
>
> You should check for errors on opening the filehandle whether it is a
file,
> STDOUT or a Pipe regardless, or your program won't tell why it's not
> working.
Sorry for the lame example, the actaul code does have the ">$filename" and
the "or die" included.
Will take make care in the future to type 'correct' examples :)
Regards,
Willem Joosten
------------------------------
Date: 30 Oct 1999 11:12:49 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: perl double-split
Message-Id: <7vejrh$4a1$1@gellyfish.btinternet.com>
In comp.lang.perl.misc Daniel Heiserer <daniel.heiserer@bmw.de> wrote:
> Hi,
>
> assume I read a file into a variable in perl:
>
> undef $/;
> $data=<>;
>
> I know how I can split the $data (according the lines) into field @Tmp
> using
> @Tmp=split('\n',$data);
>
> But assume I read a table, or comma separated file:
>
> #-----------file------------
> me,you,karl,mary,joan
> 23,3455,34543,2343,34
> #-----------file------------
>
> and I want to split it into a file using TWO separators:
> "\n" for the "lines" and "," for the columns and the resultant
> should be a double-indexed field @Tmp2:
>
> @Tmp2=howtosplit_doubles('\n',',',$data);
>
> So $Tmp2[1][1]=3455
>
> How could that be done in a that simple and similar way??????
>
You cant in a 'similar' way but its very simple;
my $data = do { local $/ = undef; <>; };
@data = map { [ split /,/ ] } split /\n/ , $data;
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 30 Oct 1999 12:12:07 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: simplifying a script
Message-Id: <7venan$4ec$1@gellyfish.btinternet.com>
In comp.lang.perl.misc Jeff Pinyan <jeffp@crusoe.net> wrote:
> On Oct 29, Abigail blah blah blah:
>
>> my @table_data = map {"bobbhtml/TableData${_}.txt"} 1 .. 11;
>
> This might be a bit nit-picky, but I bring up two points:
>
> 1. useless { and } around _ in $_
> 2. map in block format is slower than map in list format (here)
>
>
> Benchmark: timing 100000 iterations of block, block2, list, list2...
> block: 38 wallclock secs (39.31 usr + 0.00 sys = 39.31 CPU)
> block2: 37 wallclock secs (38.07 usr + 0.00 sys = 38.07 CPU)
> list: 38 wallclock secs (38.52 usr + 0.00 sys = 38.52 CPU)
> list2: 41 wallclock secs (37.97 usr + 0.00 sys = 37.97 CPU)
>
>
> Again, this might be nitpicking it *just a little*.
>
I'd say so - a maximum difference of 1.4 seconds over *100,000* iterations ? -
I make that a gnats cock over .01 milliseconds : style and taste would get
the upper hand as far as I would be concerned.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
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 1230
**************************************