[8961] in Perl-Users-Digest
Perl-Users Digest, Issue: 2579 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 13 10:40:23 1998
Date: Wed, 13 May 98 07:01:18 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 13 May 1998 Volume: 8 Number: 2579
Today's topics:
`back ticks` ? (*/chebs )
Actually a proposal: (was: Grieving our dying community <quednauf@nortel.co.uk>
Re: Anagram algorithm anyone. dennis_marti@yahoo.com
Apache and authentication <bjoern_nordmann@hp.com>
Bug/Feature wrt write/my? <demaille@inf.enst.fr>
Re: Bug/Feature wrt write/my? <demaille@inf.enst.fr>
Chicago.PM Website: http://chicago.pm.org/ (Jim Allenspach)
Compile RE pat only when I change pat? <teilipe@tss.tei.ericsson.se>
Re: Detect if a script is already running? <gp@atnet.at>
Re: Does Perl have a IDE?I don't like command line. (Shaun Sides)
eval doesn't catch exit in custom die (Bart Lateur)
Re: How can you break out of a 'while... ' loop in a fu (Tina Marie Holmboe)
Re: How can you break out of a 'while... ' loop in a fu <tchrist@mox.perl.com>
Re: Installing PERL on NT <jwilson@ic.ac.uk>
Re: Learning Perl vs Programming Perl (Books) <gp@atnet.at>
Re: need help capturing error (Andrew E Page)
Re: Need Perl command to pull HTML from a remote site. <jasmatt@es.co.nz>
Perl compiler: does it work <rjk@fprsdev3.fmr.com>
Perl has allowed me to become a better programmer <Scott.L.Erickson@HealthPartners.com>
Re: Program to give day of the week from given date (Mitchell Morris)
Re: Question: Finding which element of a list a string (Jim Allenspach)
Re: Question: Finding which element of a list a string <rjk@fprsdev3.fmr.com>
Re: Randomly sorting an array <etoxkar@eto.ericsson.se>
Somebody a script for doing tcl2pl <jverbrug@be.oracle.com>
Re: Stripping HTML Tags from a file <jasmatt@es.co.nz>
Re: Tip: Filehandles <jhoglund@mirage.skypoint.net>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 13 May 1998 11:45:02 GMT
From: chebs@elfin.org (*/chebs )
Subject: `back ticks` ?
Message-Id: <355c87bb.11110933@news.demon.co.uk>
Hi all
I'm trying to set a files permission from a perl script using
`chmod 0777 $file`;
It works when script created the file [upload] or from the shell but
not if I call the script via a browser
I have studied several 'works from the command line not as cgi' posts
But haven't found an answer yet.
I have tried system() and qx/ but I didn't think 'chmod' returned anything.
Any help would be a great help.
Thanks!
chebs
------------------------------
Date: Wed, 13 May 1998 14:18:21 +0100
From: "Frank L. Quednau" <quednauf@nortel.co.uk>
Subject: Actually a proposal: (was: Grieving our dying community)
Message-Id: <35599D9D.82C50D9@nortel.co.uk>
>
Sorry if I sound arrogant now, but this thread is starting to suck. It
started as a question to all what could be improved instead of moaning, and
it has turned into a lot of complains. I got one response on the bot idea
thing stating that someone still would have to check if responses were
indeed given correctly. However, I am not sure. But the bot is quite
impersonal as well. So, here another idea which I might be able to realise on
my webpage as I could do it with Jscript. What about a wizard (I know, it's a
Microsoft idea, but at times it's useful), were people start from predefined
values (eg, do you have a problem with mailing? variables? regular
expressions? premature...?) and goes down until hopefully there is an answer.
If there is no answer, then they could have directly a link to the relevant
newsgroup, and that is not only the Perl newsgroups, but also the cgi, html,
Jscript, C and what have you newsgroups available. I would be willing to
start this project, provided the University allows me to spread myself
further, and I would get help from a few people, helping me structurise the
information available. Of course I'd prefer doing the whole thing in perl,
but I haven't got access to a cgi-bin. What do you people think?
--
____________________________________________________________
Frank Quednau
http://www.surrey.ac.uk/~me51fq
________________________________________________
------------------------------
Date: Wed, 13 May 1998 13:33:53 GMT
From: dennis_marti@yahoo.com
Subject: Re: Anagram algorithm anyone.
Message-Id: <6jc7g1$qal$1@nnrp1.dejanews.com>
In article <6jb8tp$f5c$1@nnrp1.dejanews.com>,
dennis_marti@yahoo.com wrote:
>
> You can make it about four times "quicker" with a couple changes.
Sorry to follow up to myself, but I should have added "more buggy and
less portable" to the above. Aside from testing the open incorrectly,
the egrep pattern that worked on HPUX failed miserably on Linux. It's
still faster with a pipe from grep on Linux, but the pattern changes
to "^[$word\U$word]\\{$len\\}\$".
Dennis Marti
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Wed, 13 May 1998 13:01:46 +0200
From: Bjoern Nordmann <bjoern_nordmann@hp.com>
Subject: Apache and authentication
Message-Id: <35597D9A.656BAB4D@hp.com>
This is a multi-part message in MIME format.
--------------52E36828DBC7692100E121CF
Content-Type: multipart/alternative; boundary="------------AAFEEAF1B37D3B607E21C206"
--------------AAFEEAF1B37D3B607E21C206
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Hi
Before I have installed the Apache 1.3 Server I had a NCSA server.
I've a .htaccess file :
<Limit GET POST>
require group xyz
</Limit>
Now I have written some Perl-Scripts and I want to test the
$ENV{'REMOTE_GROUP'} variable. For NCSA this is no
problem, for Apache this variable is empty.
Does someone have experience with this problem ?
Kind Regards
Bjoern Nordmann
--------------AAFEEAF1B37D3B607E21C206
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<HTML>
Hi
<P>Before I have installed the Apache 1.3 Server I had a NCSA server.
<BR>I've a .htaccess file :
<P><FONT FACE="Courier New,Courier"><Limit GET POST></FONT>
<BR><FONT FACE="Courier New,Courier">require group xyz</FONT>
<BR><FONT FACE="Courier New,Courier"></Limit></FONT>
<P>Now I have written some Perl-Scripts and I want to test the
<BR><FONT FACE="Courier New,Courier">$ENV{'REMOTE_GROUP'}</FONT> variable.
For NCSA this is no
<BR>problem, for Apache this variable is empty.
<P>Does someone have experience with this problem ?
<P>Kind Regards
<BR>Bjoern Nordmann</HTML>
--------------AAFEEAF1B37D3B607E21C206--
--------------52E36828DBC7692100E121CF
Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Bjoern Nordmann
Content-Disposition: attachment; filename="vcard.vcf"
begin: vcard
fn: Bjoern Nordmann
n: Nordmann;Bjoern
org: Hewlett Packard Company
email;internet: bjoern_nordmann@hp.com
title: Web-Programming Engineer
x-mozilla-cpt: ;0
x-mozilla-html: FALSE
version: 2.1
end: vcard
--------------52E36828DBC7692100E121CF--
------------------------------
Date: 13 May 1998 13:59:14 +0200
From: Akim Demaille <demaille@inf.enst.fr>
Subject: Bug/Feature wrt write/my?
Message-Id: <qylvhraidpp.fsf@ubu.enst.fr>
Hi!
I'm a newbie to perl, but got a problem I'd like to consider as a bug.
If it is not, then, hell, can somebody give me a good reason for this
script not to do what one expects (i.e., the same behavior as print
has).
ubu /tmp \$ cat test.pl
#! /usr/local/bin/perl
my $i;
$i = 5;
foreach $i (1 .. 3)
{
format =
@<<<
$i
.
write;
}
ubu /tmp \$ perl test.pl
5
5
5
Thanks,
Akim
--
P-mail: Akim Demaille, 107 rue Bobillot, F-75013 Paris, France
E-mail: demaille@inf.enst.fr
V-mail: +33 1 45 81 78 68
------------------------------
Date: 13 May 1998 15:00:58 +0200
From: Akim Demaille <demaille@inf.enst.fr>
Subject: Re: Bug/Feature wrt write/my?
Message-Id: <qyl1ztyiaut.fsf@ubu.enst.fr>
>>>>> "Akim" == Akim Demaille <demaille@inf.enst.fr> writes:
Akim> Hi!
Hi!
Akim> I'm a newbie to perl, but got a problem I'd like to consider as
Akim> a bug. If it is not, then, hell, can somebody give me a good
Akim> reason for this script not to do what one expects (i.e., the
Akim> same behavior as print has).
Akim> ubu /tmp \$ cat test.pl
Akim> #! /usr/local/bin/perl
Akim> my $i;
Akim> $i = 5;
Akim> foreach $i (1 .. 3)
Akim> {
Akim> format =
Akim> @<<<
Akim> $i
Akim> .
Akim> write;
Akim> }
Akim> ubu /tmp \$ perl test.pl
Akim> 5
Akim> 5
Akim> 5
You should have mentioned you used perl 5.003. It appears it was
truly a bug, and this code does work as expected with 5.004_04.
Please upgrade.
:)
Thanks for the answers,
Akim
--
P-mail: Akim Demaille, 107 rue Bobillot, F-75013 Paris, France
E-mail: demaille@inf.enst.fr
V-mail: +33 1 45 81 78 68
------------------------------
Date: 13 May 1998 08:05:02 -0500
From: jima@MCS.COM (Jim Allenspach)
Subject: Chicago.PM Website: http://chicago.pm.org/
Message-Id: <6jc5pu$1eu@Mars.mcs.net>
Keywords: Chicago Perl Mongers
The Chicago chapter of Perl Mongers now has an official Website up
at http://chicago.pm.org/ . Interested parties in the Chicago area (and
elsewhere) are invited to check it out.
jma
------------------------------
Date: Wed, 13 May 1998 08:30:56 +0200
From: Peng Li <teilipe@tss.tei.ericsson.se>
Subject: Compile RE pat only when I change pat?
Message-Id: <35593E20.A809B7E8@tss.tei.ericsson.se>
This is a multi-part message in MIME format.
--------------4D081DBD9FE1CE94F8377C64
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
As I understand in PERL, if you use variable in regular
expression, you have only two choices:
1) compile only once for the script life time by adding o flag
2) compile every time when you use the RE
It's great!!! But I have one question, if it'is possible that
recompile the REG pattern if I change the pattern value but not
recompile each time I use this pattern in Regular expression.
for example:
sub match {
$pat = shift;
while (<FH>) {
if ( /$pat/o ) {...}
}
}
What I mean is, in the while loop, can PERL just
compile one time in the reg exp /$pat/, and recompile it again when
I recall the function match.
I've used the o flag when I dosen't change the $pat at all, unfortunelly
when I use o flag I can't change $path anymore :<
Can anybody help me. Thanks in advanced for your attention.
/Peng
--
*************************************************************************
Li Peng (teilipe@tss.tei.ericsson.se)
Ericsson Telecomunicazioni Italia S.p.A.
Via Anagnina, 203 - 00040 - Roma - Italia
Tel +39 6 72582911 Fax +39 6 72583127
*************************************************************************
"Honesty is the best policy, but insanity is a better defense"
--------------4D081DBD9FE1CE94F8377C64
Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Peng Li
Content-Disposition: attachment; filename="vcard.vcf"
begin: vcard
fn: Peng Li
n: Li;Peng
org: Ericsson Telecomunicazioni SpA
adr: Via Anagnina, 203;;;Roma;;00040;Italy
email;internet: teilipe@tss.tei.ericsson.se
title: Technical Coordinator & Designer
tel;work: +39 6 7258 2911
tel;fax: +39 6 7258 3127
x-mozilla-cpt: maxwell;2
x-mozilla-html: TRUE
version: 2.1
end: vcard
--------------4D081DBD9FE1CE94F8377C64--
------------------------------
Date: Wed, 13 May 1998 13:28:11 +0200
From: Gerhard Poul <gp@atnet.at>
To: "Aloud.com" <alex@aloud.com>
Subject: Re: Detect if a script is already running?
Message-Id: <Pine.LNX.3.96.980513132523.9260B-100000@shadow.ccc.at>
Hi,
On Mon, 11 May 1998, Aloud.com wrote:
> Is there anyway to detect whether a perl script is already running?
>
> You could do it really crudely by ps -ef | grep pl ...etc
>
> There must be a perl command or something nicer?
I ever thought lock files would be a good method for doing that task....
Just locate them in /var/lock (I think that's LFSS) and check it before
doing something...
cu,
Gerhard
------------------------------
Date: 13 May 1998 13:44:03 GMT
From: arch@abts.net (Shaun Sides)
Subject: Re: Does Perl have a IDE?I don't like command line.
Message-Id: <slrn6limse.dr5.arch@abts.net>
Original message by: Birgitt Funk <birgitt@order.booktraders.com>
Date: Tue, 12 May 1998 16:25:30 -0400
Subject: Re: Does Perl have a IDE?I don't like command line.
> So, I repeat my question, can Perl be the first programming language
> to learn programming with or not ?
>
> Isn't any programming student by definition programmatically challenged
> ?
>
> There a nonprogramming programming students who want to learn
> programming
> and use Perl as their first programming language. They don't necessarily
> complain, nor see it as a consumerist toy.
I might fit that label. ;-)
I'm hardly a programmer. Taken a couple of classes in pursuit of a
2-year degree. Intro to C, Basic, VB5. None of em went nearly far
enough. Anyway, to the point. I've read more and more as time's gone
by. I like C, and shell (took a unix class, too). So, when I finally
started examining Perl I quickly decided that it was the one for me to
obtain a high level of proficiency at. That's what I'm working on now.
--
Shaun L. Sides arch@abts.net
Business web site http://www.abts.net/~arch
Showershoe web site http://www.abts.net/~arch/showershoe
Recreational web site http://sara.mmlc.nwu.edu/~arch
------------------------------
Date: Wed, 13 May 1998 12:59:11 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: eval doesn't catch exit in custom die
Message-Id: <355a98e4.2831823@news.tornado.be>
What a cryptic subject line. But anyway, here's the problem. The
recommended way to do some things, like timeouts, is through an eval/die
pair. However, I've noticed that if you set $SIG{__DIE__} to do some
custom reporting, like in
$SIG{__WARN__} = sub { ... }; # custom error report
$SIG{__DIE__} = sub { &{$SIG{__WARN__}; exit(1); };
# custom error report and terminate
then, in
eval {
$SIG{ALRM} = sub { die "timeout\n"; };
alarm 20;
...
alarm 0;
}
"die" isn't caught! It remains fatal!
The only way around this (that I found), is to clear $SIG{__DIE__} in
the eval blok:
eval {
local($SIG{__DIE__}); #back to standard Perl die
...
}
Question: is there another way to terminate a __DIE__ sub, that is NOT
fatal in eval? "die" doesn't die in eval, but ONLY if you didn't set
$SIG{__DIE__} yourself (even outside of the eval block). Surely, this
can't be the way it's supposed to be?
Bart.
------------------------------
Date: 13 May 1998 12:48:40 GMT
From: tina@scandinaviaonline.se (Tina Marie Holmboe)
Subject: Re: How can you break out of a 'while... ' loop in a function?
Message-Id: <6jc4r8$o3a$1@news1.sol.no>
In article <6jaarr$lpr$3@csnews.cs.colorado.edu>,
Tom Christiansen <tchrist@mox.perl.com> writes:
> [courtesy cc of this posting sent to cited author via email]
I would very much prefer not to have CC's - my mailbox is slightly
cluttered these days. Thankyou.
>: To me, though I am admittedly strange, they translate to goto... there
>:*is* some good advice in not breaking out of while-loops - or any other
>:loops - in more than one place.
>
> Larry has declared that line of reasoning to be bull.
Your point being ... what ?
--
Tina Marie Holmboe
Application Developer (Geeks'R'Us) [tina@tech.scandinaviaonline.se]
Scandinavia Online AB Development Dept. (+46) 08 587 81000 (switchboard)
(+46) 08 587 81189 (direct)
------------------------------
Date: 13 May 1998 13:42:57 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: How can you break out of a 'while... ' loop in a function?
Message-Id: <6jc811$36j$1@csnews.cs.colorado.edu>
In comp.lang.perl.misc,
tina@tech.scandinaviaonline.se writes:
:>: To me, though I am admittedly strange, they translate to goto... there
:>:*is* some good advice in not breaking out of while-loops - or any other
:>:loops - in more than one place.
:>
:> Larry has declared that line of reasoning to be bull.
:
: Your point being ... what ?
I do grow tired of having to prove every little thing. I happen to have a
life, you know. Being free compsci professor on the net is not that life,
especially when it comes to debunking their sacred cows that leave them
FiTH, like this one. But I don't want to see this broken idea spread,
so let's nip it in the bud.
The point is that this phobia about avoiding control-flow alterations
is pure bunk. It complicates your program and renders it difficult
to maintain. Pascal was a horrible botch. Remove next, last, redo,
and return from the language, and all you have is spurious conditionals
and continually nesting complexity. This is bad software engineering
which you are espousing.
Quoting the Camel book:
In the early days of structured programming, some people insisted
that loops and subroutines have only one entry and one exit.
The "one entry" notion is still a good idea, but the "one exit"
notion has led people to write a lot of unnatural code. Much of
programming consists of traversing "decision trees". A decision
tree naturally starts with a single trunk but ends with many leaves.
Write your code with the number of loop exits (and function returns)
that is natural to the problem you're trying to solve. If you've
declared your local variables with reasonable scopes, things will
automatically get cleaned up at the appropriate moment, whichever
way you leave the block.
To be honest, I don't remember whether Larry first wrote that part or
I did, but it has his style. I'm pretty sure it's his, not mine.
--tom
--
"It's easier to make up sayings people like to hear than sayings they
like to heed."
--Larry Wall
------------------------------
Date: 13 May 1998 11:05:48 GMT
From: "Jeff Wilson" <jwilson@ic.ac.uk>
Subject: Re: Installing PERL on NT
Message-Id: <01bd7e5e$e9bb3e30$d53ec69b@leicester>
You don't say what the error is but here are a few basics.
You don't need a top line like "#! /usr/bin/perl". Instead create
your script files with a suffix like ".PL" and create a file type
from "My Computer/View/Options .. File Types" interface between your
perl executable, probably "C:\PERL\BIN\PERL.EXE" and the ".PL"
suffix. Then when you double-click on the script it will run
automatically in a DOS window.
You can also run the script from a "MS-DOS Prompt" window ..
something like "C:\PERL\BIN\PERL.EXE scriptname" - or just
"scriptname.pl" if the file type has been created.
Note that if you run a script by double-clicking, the DOS window will
close when the script is complete. If you wish to see the result
append a "getc;" to the script to hold the window open until you hit
CR.
--
.
Jeff Wilson
London - UK
Hauk Langlo <hauk@forumnett.no> wrote in article
<3557F603.33C0D4B0@forumnett.no>...
> Hi there. After using PERL at work for some weeks I have finally
got my
> own PC at home. I'm pretty new to the PC format and have not
managed to
> successfully install/build perl on my PC. I got a file called
> perl5.00402-bindist04-bc. I have done the installation process but
my
> perl programs will not work like they do at my job, they will not
work
> at all really. Do anyone know exactly what kind of thins I will
have to
> do in order to run PERL programs on my Win-NT PC? Any help would be
> apprecuated. Thanks.
>
> Hauk Langlo (JAPH)
>
>
>
------------------------------
Date: Wed, 13 May 1998 13:37:06 +0200
From: Gerhard Poul <gp@atnet.at>
To: Treeskunk <Treeskunk@aol.com>
Subject: Re: Learning Perl vs Programming Perl (Books)
Message-Id: <Pine.LNX.3.96.980513133015.9260C-100000@shadow.ccc.at>
Hi,
On Mon, 11 May 1998, Treeskunk wrote:
> I'm a programmer and am interested in both of these books. I would like to get Learning because it talks about CGI. However, I would like to get Programming because I feel it is probably more for programmers. Any suggestions? Is the information from the CGI chapter in Learning available anywhere else (on the net) so if I get Programming I will not miss anything?
What are you thinking of buying the WebMaster in a Nutshell Deluxe
Edition?? There you have a CD-Rom with the following books in HTML:
o) HTML: The Definitive Guide
If you cannot use this one for something else, read it for writing good
Perl CGIs ;->>>
o) CGI Programming on the World Wide Web
o) JavaScript: The Definitive Guide
o) Programming Perl
o) Web Master in a Nutshell
You can read the Preface of all these books online at
http://online-books.ora.com/mod-bin/books.mod/webrof/
But you also get a key with WebMaster in a Nutshell so you can use ALSO
the Onlinelibrary for one year (I think one year) but you also have the
versions on your CDROM, but if there comes a new edition you can only read
it over the WorldWideWeb...
You can find more details at online-books.ora.com and you can also ONLY
buy the electronical versions over the internet, but you don't have the
CDROM and a printed version of the WebMaster in a Nutshell then...
cu,
Gerhard
PS: Hope it helps...
------------------------------
Date: Wed, 13 May 1998 12:29:31 GMT
From: aep@world.std.com (Andrew E Page)
Subject: Re: need help capturing error
Message-Id: <EswAp8.4CA@world.std.com>
In article <894844634.724856@michelob>, craig green <cagreen@sprint.ca> wrote:
>Hi, I've just started with Perl and need help...
> I need help to capture the error output.
> What I am doing is calling a program (say prog1) and giving it a file
>(file.ext1). This returns another file (file.ext2), which I give to another
>program (prog2). This second program returns a file (file.ext3). But it also
>produces a report to the screen ( standard error?). My problem is that I
>need to get this report as a string so I can then furthur process it. and I
>cannot change prog2 in anyway. If anyone can help me I would be forever
>greatful!!! Thanks in advance.
>
>Craig.
>
>
Sounds like you want to open up a pipe.
open( READ_OUTPUT, "prog2 |") || die "open failed\n" ;
while( <READ_OUTPUT> ) {
# Process output in $_
}
Ref Programming Perl 2nd Edition, Larry Wall, O'Reilly & Assoc, pg 341
--
Andrew E. Page (Warrior Poet) | Decision and Effort The Archer and Arrow
Mac Consultant | The difference between what we are
Macintosh and DSP Technology | and what we want to be.
------------------------------
Date: Thu, 14 May 1998 01:52:44 +1200
From: Matt McKenzie <jasmatt@es.co.nz>
Subject: Re: Need Perl command to pull HTML from a remote site. (HTTPGET)??
Message-Id: <3559A5AB.3B2BEA12@es.co.nz>
Use the Simple.pm module from libwww-perl
i.e.
use LWP::Simple qw(get);
my $data get('http://the.server.and/the_path/to_the_file.html');
not sure about the date though.
elitegrp@pond.net wrote:
> Thanks in advance for any assistance I can get!
>
> I am trying to find a command in Perl (possibly HTTPGET??) that will pull
> HTML off of a remote site by URL alone. Also, once this document is pulled
> from the remote server, is there a way I can find the date of that file (the
> last time it was updated)?
>
> Although I am certain there is no command that does "just that"...I would
> surely appreciate any suggestions that anyone would have......tiny code
> snippets are also welcomed...just a Perl beginner here trying to make a
> script! :)
>
> Krista
> elitegrp@pond.net
>
> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Wed, 13 May 1998 08:04:58 -0400
From: Rick Meldrum <rjk@fprsdev3.fmr.com>
Subject: Perl compiler: does it work
Message-Id: <35598C6A.21D1@fprsdev3.fmr.com>
Akim Demaille wrote:
>
> Hi!
>
> I'm a newbie to perl, but got a problem I'd like to consider as a bug.
> If it is not, then, hell, can somebody give me a good reason for this
> script not to do what one expects (i.e., the same behavior as print
> has).
I have an app that would work a lot better with compiled code, but
I'm a little hesitant to use a perl compiler. Call it fear of the
unknown... Does anyone have experience using one? If so, can you
tell me about your experience(s) doing so? (reliability, bugs,
performance, where a good one is, etc.)
Any info would be most appreciated.
Thanks,
Rick
------------------------------
Date: Wed, 13 May 1998 07:48:09 -0500
From: scott <Scott.L.Erickson@HealthPartners.com>
Subject: Perl has allowed me to become a better programmer
Message-Id: <35599689.698EB581@HealthPartners.com>
Tom Christiansen wrote:
> In comp.lang.perl.misc, mwmaurer@mtu.edu (Mark Maurer) writes:
> :I think it could be wise to throw Perl in with C as a language NOT to teach
> :to an aspiring programmer first...
>
> That depends on how it's taught. Certainly the crux of becoming a programmer
> is developing the algorithmic mentality. Worrying about memory management,
> strong typing, and other idiocies interferes with that process.
I agree with Tom with regards to his comment about worrying about memory
management, typing, etc.
I believe Perl has allowed me become a better programmer. While in
college, I learned the basics of programming with Pascal and then
quickly moved "up" to C programming. However, I had a rather difficult
time understanding the algorithms being taught because I was so wrapped
up in trying to figure out pointers, typing, and memory management in C.
However, now that I use Perl for my most of my programming endeavors, I
am finally understanding the algorithms that are presented to me because
I no longer have to deal with all the tricky details of C (this is not
to say that Perl does not have its share of tricky details). By
comparison, Perl seems, to me, to be more straight forward, in many
ways, than is C.
And now that I feel competent in a programming language (Perl), I am
putting forth a greater effort to improve my algorithmic thinking and to
decrease my use of hacking.
Scott.
------------------------------
Date: 13 May 1998 11:49:08 GMT
From: mgm@unpkhswm04.bscc.bls.com (Mitchell Morris)
Subject: Re: Program to give day of the week from given date
Message-Id: <slrn6lj25k.i8k.mgm@unpkhswm04.bscc.bls.com>
On Tue, 12 May 1998 14:40:33 +0100, Hari Patel <hari.patel@bt.com> wrote:
> Does anybody know how to output day of teh week for a given date in
>perl
> e.g. if you have date as 13/5/98 pass it to some function which
>would output
> Wednesday........
>
> Please email me with any suggestions
>
> hari.patel@bt.com
>
>Many thanks
>
>hari
>
#! /usr/local/bin/perl -w
use POSIX;
sub get_day_of_week ($) {
my ($mon, $mday, $year) = split /\//, $_[0];
$mon--;
return ("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday",
"Saturday")[(localtime mktime 0, 0, 0, $mday, $mon, $year)[6]];
}
--
Mitchell Morris
mmorris@mindspring.com
If I had any humility I would be perfect.
-- Ted Turner
------------------------------
Date: 13 May 1998 07:27:39 -0500
From: jima@MCS.COM (Jim Allenspach)
Subject: Re: Question: Finding which element of a list a string corilates to
Message-Id: <6jc3jr$brn@Jupiter.Mcs.Net>
nick@hob.com writes:
>I'm trying to find out what position a given string holds in a list
You might check the Perl FAQ (http://language.perl.com/faq/). It
has an answer to this very question (look in perlfaq4 for the question "How
can I tell whether an array contains a certain element?"). Hope this helps.
jma
------------------------------
Date: Wed, 13 May 1998 08:29:17 -0400
From: Rick Meldrum <rjk@fprsdev3.fmr.com>
To: nick@hob.com
Subject: Re: Question: Finding which element of a list a string corilates to
Message-Id: <3559921D.357A@fprsdev3.fmr.com>
nick@hob.com wrote:
>
> This problem is really bothering me because I feel like I am forgeting an
> obvious perl function in my rustiness. I think coding more than 4 languages
> in a given month scrambles my brain. Any help would be greatly appreciated.
>
> I'm trying to find out what position a given string holds in a list
>
> If I have a list like this:
> @Months = (Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec);
>
I don't use an array, but this has worked for me:
$mon = 'Jan'; # for instance
$Months = 'Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec'
$month_number = index($Months, $mon) / 4;
# index() returns the position in the string. Since each entry is 4
# characters (with the space) I divide by 4 to get the desired number.
# A negative result should indicate that $mon is not in the list.
HTH
Rick
------------------------------
Date: Wed, 13 May 1998 14:16:44 +0200
From: Kjell Arne Rekaa <etoxkar@eto.ericsson.se>
Subject: Re: Randomly sorting an array
Message-Id: <35598F2C.1C29A3D0@eto.ericsson.se>
None of these examples do work!
(It's a good idea to test them first)
Chip Salzenberg wrote:
>
> > for my $i (1..$#list) { # Yes, start at 1!
The "my" before "$i" generates compilation error
>
> A simpler approach:
Nice idea, but loops forever!!
> push @new, $_[rand @_] while @_;
The line above must be:
push @new, splice (@_, rand @_, 1) while @_;
--
Kjell Arne Rekaa
Email: etoxkar@eto.ericsson.se
Though I'll admit readability suffers slightly...
--Larry Wall in <2969@jato.Jpl.Nasa.Gov>
------------------------------
Date: Wed, 13 May 1998 15:41:50 +0200
From: Johan Verbrugghen <jverbrug@be.oracle.com>
Subject: Somebody a script for doing tcl2pl
Message-Id: <Pine.HPP.3.96.980513153431.18001A-100000@chimay.be.oracle.com>
Hi,
I'm looking for a convertor for doing a conversion from (rather simple)
tcl to perl.
I'm aware of some packages on CPAN, doing it on the fly, but it should be
something offline, in the sens of cross-compiling it, resulting in *.pl.
Anybody aware of such a scripts/modules ?
Thx,
Johan
*****************************************************************************
Johan Verbrugghen Email jverbrug@be.oracle.com
------------------------------
Date: Thu, 14 May 1998 01:53:42 +1200
From: Matt McKenzie <jasmatt@es.co.nz>
Subject: Re: Stripping HTML Tags from a file
Message-Id: <3559A5E5.D4E3EB7B@es.co.nz>
that rexexp doesn't work for ver 5.004 I discovered.
s/<(?:[^>'"]+|(['"]).*?\1)*>//gs does the trick
'bout time perlfaq9 was updated
Heribert Wettels wrote:
> Hakan Hjelmstrom wrote:
>
> > [CC of this post emailed to author]
> > On Mon 11 May 1998 12:53:26 +1200, Matt McKenzie wrote:
> > > I have spent days trying various methods including the HTML::Parser,
> > > HTML::Filter modules, reading the FAQ's:
> > > <snipped from perlfaq9>------How do I remove HTML from a string?
> > > #!/usr/bin/perl -p0777
> > > s/<(?:[^>'"]*|(['"]).*?\1)*>//gs
> > > -----------------------------------
> > > I'm not sure how to implement this into my script.
> >
> > $html_laden_text =~ s/<(?:[^>'"]*|(['"]).*?\1)*>//gs
> > would do the trick, but as the FAQ states, using the modules availible
> > is safer.
> >
>
> or for an array:
>
> foreach $text(@text) {
> $text =~ s/<(?:[^>'"]*|(['"]).*?\1)*>//gs
> }
>
> Heribert
>
> > Hekan Hjelmstrvm
> > hawk@algonet.se
>
> --
> PGP fingerprint = 4B 68 BF FA B0 81 59 F7 E2 86 5C D2 78 B9 37 28
> Public key at: http://www.respublica.de/pgp/wettels-pubkey.txt
------------------------------
Date: 13 May 1998 13:40:16 GMT
From: Jamie Hoglund <jhoglund@mirage.skypoint.net>
Subject: Re: Tip: Filehandles
Message-Id: <6jc7s0$hkn$1@shadow.skypoint.net>
Tom Christiansen <tchrist@mox.perl.com> wrote:
: and then go and suck in a megamodule just because you're afraid of a star.
Wow, I think those are the stronges words I've ever heard from you. :-)
Seriously, what is wrong with using globs? I've been told not to use them,
but personally, I find them more intuitive than the $Variable->{name}
stuff, purely a personal preference as far as I'm concerned, but is there
a real performance oriented reason for avoiding globs?
To me, doing something like *subname = \&module::subname; makes a lot
more sense, but I almost never see people do that, I know there is
probably a good reason for this, but are there consequences? (other than I
can't use $subname as a scalar w/out messing things up, I wouldn't want
to anyway.) Or is it just "perlitically incorrect"? :-)
Jamie
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.
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 2579
**************************************