[18582] in Perl-Users-Digest
Perl-Users Digest, Issue: 750 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Apr 24 00:06:03 2001
Date: Mon, 23 Apr 2001 21: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: <988085108-v10-i750@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 23 Apr 2001 Volume: 10 Number: 750
Today's topics:
Re: * mail server not work on NT through cable modem <juex@deja.com>
Re: 5.6.0 vs. 5.6.1 (was: Re: Issue with 5.004 to 5.6 u (H. Merijn Brand)
Re: 5.6.0 vs. 5.6.1 (was: Re: Issue with 5.004 to 5.6 u (Tad McClellan)
avoid having to hit the enter key <ptreen@empire.net>
Re: avoid having to hit the enter key <wyzelli@yahoo.com>
Can I include local perl snipits? <silicontao_roy@technologist.com>
Re: GD/TrueType weirdness (CODE SAMPLE) (Martien Verbruggen)
Re: Good editor for perl (Anno Siegel)
Re: Good editor for perl <bodybuilder_98@hotmail.com>
Re: Good editor for perl <ivoz@starmail.com>
How secure is this.... <simon@super-simon.com>
Re: How secure is this.... (Malcolm Dew-Jones)
Re: Idiom: the expression of a copied & substituted str <mischief@velma.motion.net>
Microsoft Access <hafateltec@hotmail.com>
Re: Microsoft Access (Craig Berry)
Multi-Line Text Editor <gizmo-p@erols.com>
Please help (pat)
Re: Please help (The Mosquito ScriptKiddiot)
Re: Please help (Tad McClellan)
Re: Please help <wyzelli@yahoo.com>
Re: Please help <joe+usenet@sunstarsys.com>
Re: pointer/reference question (Andrew J. Perrin)
Re: Problem with associative array--what am I doing wro (Alan Barclay)
Re: readdir command <krahnj@acm.org>
Re: RegEx optimization assistance <bart.lateur@skynet.be>
Re: RegEx optimization assistance <krahnj@acm.org>
Re: RegEx optimization assistance <bart.lateur@skynet.be>
Re: regular expression question <krahnj@acm.org>
Re: US$50 prize for hash failure from 'delete' inside a <dan@tuatha.sidhe.org>
Re: US$50 prize for hash failure from 'delete' inside a (Craig Berry)
web log parsing <igor.spivak@intrinsic.com>
Re: Where is my script (Craig Berry)
Re: Which is faster/better? (Charles DeRykus)
Re: Windows Perl for Windows 95 -- Internet Explorer 5 (Charles M. Kozierok)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 23 Apr 2001 15:42:48 -0700
From: "Jürgen Exner" <juex@deja.com>
Subject: Re: * mail server not work on NT through cable modem
Message-Id: <3ae4afe8$1@news.microsoft.com>
<ts1@its.com.sg> wrote in message news:3ae4a6e9$1@news.starhub.net.sg...
> I had tried many mail server, on my Windows NT or Windows 2000 server, my
server connect through cable modem which assigned by DHCP server an IP
address,
>
> my computer installed windows 2000, and I had tried Rockliffe Mailsite,
Imail, etc , mail server.
[...]
I think your Perl script is missing a semicolon at the end of line 42.
jue
------------------------------
Date: Tue, 24 Apr 2001 00:13:53 +0200
From: h.m.brand@hccnet.nl (H. Merijn Brand)
To: comp.lang.perl.misc
Subject: Re: 5.6.0 vs. 5.6.1 (was: Re: Issue with 5.004 to 5.6 upgrade)
Message-Id: <Xns908D25AD80CMerijn@192.0.1.90>
Bart Lateur <bart.lateur@skynet.be> wrote in
<uk48et0s64jmausqgqvkbqpeis6pca4dlg@4ax.com>:
>Abigail wrote:
>
>> - You probably want 5.6.1, not 5.6.0.
>>
>> I hope you installed 5.6.0 on your test system, and not your production
>> system.
>
>At least one person with a clear preference.
>
>But what exactly are these problems with 5.6.0, that hopefully got fixed
>in 5.6.1? And are there any new problems in 5.6.1 that people already
>know of?
*lots of* memory leaks
>And how come 5.6.1 from ActiveState is still marked "BETA"?
--
H.Merijn Brand Amsterdam Perl Mongers
(http://www.amsterdam.pm.org/)
using perl-5.005.03, 5.6.0, 5.6.1, 5.7.1 & 623 on HP-UX 10.20 & 11.00, AIX
4.2
AIX 4.3, WinNT 4, Win2K pro & WinCE 2.11 often with Tk800.022 &/| DBD-
Unify
ftp://ftp.funet.fi/pub/languages/perl/CPAN/authors/id/H/HM/HMBRAND/
------------------------------
Date: Mon, 23 Apr 2001 22:27:23 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: 5.6.0 vs. 5.6.1 (was: Re: Issue with 5.004 to 5.6 upgrade)
Message-Id: <slrn9e9p4b.obh.tadmc@tadmc26.august.net>
H. Merijn Brand <h.m.brand@hccnet.nl> wrote:
>Bart Lateur <bart.lateur@skynet.be> wrote in
>>But what exactly are these problems with 5.6.0, that hopefully got fixed
>>in 5.6.1? And are there any new problems in 5.6.1 that people already
>>know of?
>
>*lots of* memory leaks
Err, which of the two questions is that answer for?
Is it, "5.6.0's leaks were plugged in 5.6.1",
or is it "5.6.1 has leaks"?
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 23 Apr 2001 20:13:36 -0400
From: Phil Treen <ptreen@empire.net>
Subject: avoid having to hit the enter key
Message-Id: <3AE4C530.2509A7B2@empire.net>
I have written a perl script that uses the system command, the script
stalls until the enter key is hit. Is there any way to avoid this
Thanks in Advance
Phil
------------------------------
Date: Tue, 24 Apr 2001 10:07:11 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: avoid having to hit the enter key
Message-Id: <1G3F6.6$SR4.2486@vic.nntp.telstra.net>
"Phil Treen" <ptreen@empire.net> wrote in message
news:3AE4C530.2509A7B2@empire.net...
> I have written a perl script that uses the system command, the script
> stalls until the enter key is hit. Is there any way to avoid this
That would depend on WHY it stalls wouldn't it?
Maybe show the relevant section of the code?
Wyzelli
--
#Modified from the original by Jim Menard
for(reverse(1..100)){$s=($_!=1)? 's':'';print"$_ bottle$s of beer on the
wall,\n";
print"$_ bottle$s of beer,\nTake one down, pass it around,\n";
$_--;$s=($_==1)?'':'s';print"$_ bottle$s of beer on the
wall\n\n";}print'*burp*';
------------------------------
Date: Mon, 23 Apr 2001 23:06:57 GMT
From: God_Of_Pain <silicontao_roy@technologist.com>
Subject: Can I include local perl snipits?
Message-Id: <lA2F6.13696$iw5.1987936@news0.telusplanet.net>
On my web site I have a cgi-bin and I am using a few functions over and
over again. I don't have access to the perl modules directory.
Is there some way to put my functions into a command file in my cgi-bin and
just include them like #include "my_file" in C?
Should I write a local perl module? Can I have a module in my cgi-bin?
What is the best way?
------------------------------
Date: Tue, 24 Apr 2001 02:16:36 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: GD/TrueType weirdness (CODE SAMPLE)
Message-Id: <slrn9e9og4.548.mgjv@verbruggen.comdyn.com.au>
On Mon, 23 Apr 2001 08:18:11 -0500,
Dan Harding <dharding@uiuc.edu> wrote:
> Bryan Coon wrote:
>>
>> This seems okay so far.....
>>
>> > $final = new GD::Image($stringwidth,16);
>>
>> But why a new image? I see no copy of this image ($final) onto the
>> original ($im)....
>
> Perhaps misunderstanding on my part, but I want to size the image
> being created around the width of the text string. How do I do this
> if in order to calculate said string's width, I have to have already
> created an instance of new GD::Image?
>
> In other words, I have to provide *some* dimensions initially in
> order to run GD::Image->stringTTF (hence the 100,100), but I want
> the actual image's dimensions
You don't need an image to run stringTTF as a class method. You first
run it as a class method, which will give you the dimensions you need,
then you run it as an object method.
@bb = GD::Image->stringTTF(0, 'path/to/font', $size, $angle, 0, 0, $string);
# calculate $w and $h dimensions based on @bb
my $gd = GD::Image->new($w, $h);
my $clr = $gd->colorAllocate (.....);
$gd->stringTTF($clr, 'path/to/font', $size, $angle, 0, 0, $string);
Martien
--
Martien Verbruggen |
Interactive Media Division | "In a world without fences,
Commercial Dynamics Pty. Ltd. | who needs Gates?"
NSW, Australia |
------------------------------
Date: 23 Apr 2001 22:09:50 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Good editor for perl
Message-Id: <9c297e$ci2$1@mamenchi.zrz.TU-Berlin.DE>
According to David Coppit <newspost@coppit.org>:
> On 23 Apr 2001, Anno Siegel wrote:
>
> > > Looks nice, but it's shareware and I can't find the syntax highlighting....
> >
> > Is this supposed to imply syntax hilighting is a good thing?
>
> Is this supposed to imply syntax hilighting is a bad thing?
>
> Don't insult someone because their preferences are not yours.
I expressed the opinion that syntax checkers don't do much good.
To do so, I mimicked astonishment about the fact that anyone might
think otherwise. Where is the insult?
> {
> $a = reformat<<" EOF";
> This is
> a block of
> text to be reformatted.
> EOF # Oops. 3 spaces instead of 2.
> }
Is this here for a purpose? What does it demonstrate?
Anno
------------------------------
Date: Mon, 23 Apr 2001 20:17:29 -0400
From: "John" <bodybuilder_98@hotmail.com>
Subject: Re: Good editor for perl
Message-Id: <DC3F6.7457$0d.3704595@newsrump.sjc.telocity.net>
Try looking for PCE. Its FREEWARE and decent.
Sincerely,
John
--
****************************************************************************
*****************
NETWORK MARKETING IS BOOMING!!
Learn how we're sponsoring 1000's monthly worldwide without mailing
anything,
without faxing anything, without calling anyone!
Totally Internet and system-driven and we've only scratched the surface.
Get started FREE. Sign up as an Affiliate at:
http://www.ezinfocenter.com/1463281/Free .
Then watch the explosion before your eyes. NO OBLIGATION.
****************************************************************************
*********************************
"Andre Hoeffgen" <a.hoeffgen@frost.de> wrote in message
news:3AE441FD.2F9B02B@frost.de...
> Super-Simon wrote:
> >
> > Looks nice, but it's shareware and I can't find the syntax
highlighting....
> >
> > Someone who knows something better...
> >
> > "Tom Scheper" <tom@power.net.uk> wrote in message
> > news:mfe8etstel9d38mp8vrtasqo2351sulv2c@4ax.com...
> > > On Mon, 23 Apr 2001 16:08:42 +0200, "Super-Simon"
> > > <simon@super-simon.com> shed a beam of light on us:
> > >
> > > >Hi all,
> > > >
> > > >I'm searching for a good, fast editor with syntax highlighting for
perl
> > > >(CGI) for use under Windows 2000 / Windows 98 (I use windowz only for
> > > >editing scripts, scripts runs on Linux-server). It has to be free
(I'm a
> > > >poor student ;-)
> > > >
> > > >Grtz,
> > > >
> > > >Super-Simon
> > > >
> > >
> > > Lemmy (Vi for windows) :)
> > >
> > > Do a search for "lemmy" on http://www.downloadnow.co.uk and it should
> > > pop up with version 4.0 or 4.1, whatever the latest version may be.
> > >
> > > -=Cornelis
> try http://www.vim.org/
> --
> mailto:a.hoeffgen@frost.de * Telefon: ++49 - 40 / 30 03 07 70
> frost IT-consulting GmbH * Telefax: ++49 - 40 / 30 03 07 33
> Brodschrangen 3-5 * D1 : 0175 / 26 33 557
> D-20457 Hamburg * D1-FAX : 0175 / 26 45 269
------------------------------
Date: Tue, 24 Apr 2001 05:06:31 +0300
From: "Ivo Zdravkov" <ivoz@starmail.com>
Subject: Re: Good editor for perl
Message-Id: <3ae4df38_1@news.nwlink.com>
I use EditPlus ( http://www.editplus.com/ ) and I think that it is a very
useful editor
Ivo Z
"Super-Simon" <simon@super-simon.com> wrote in message
news:9c1csm$loh$1@news1.xs4all.nl...
> Hi all,
>
> I'm searching for a good, fast editor with syntax highlighting for perl
> (CGI) for use under Windows 2000 / Windows 98 (I use windowz only for
> editing scripts, scripts runs on Linux-server). It has to be free (I'm a
> poor student ;-)
>
> Grtz,
>
> Super-Simon
>
>
------------------------------
Date: Tue, 24 Apr 2001 00:43:00 +0200
From: "Super-Simon" <simon@super-simon.com>
Subject: How secure is this....
Message-Id: <9c2b12$sbn$1@news1.xs4all.nl>
Hi,
In most security-scripts the following code is used for encryption:
print crypt($passwd,$salt);
Is this safe, or at least difficult to crack, is there something better???
Please help me.
Grtz,
Simon
------------------------------
Date: 23 Apr 2001 16:31:40 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: How secure is this....
Message-Id: <3ae4bb5c@news.victoria.tc.ca>
Super-Simon (simon@super-simon.com) wrote:
: Hi,
: In most security-scripts the following code is used for encryption:
: print crypt($passwd,$salt);
: Is this safe, or at least difficult to crack, is there something better???
: Please help me.
I understand that 'crypt' is pretty much unbreakable - assuming the
password is suitably random. E.g. If a user chooses a password of
"rabbits" then a dictionary attack could break the password. On the
otherhand, a password of "djEU37d:kdcm/ekE048G467hFbf" might be hard to
crack.
HOWEVER, the real weakness will be in how it is used, THEREFORE I can't
say that in your application this will be safe, or whether there is
something better.
It could be that a completely different approach is the only thing that
would be secure - e.g. on the web using HTTPS instead of HTTP and skipping
the crypt function altogether.
--
Want to access the command line of your CGI account? Need to debug your
installed CGI scripts? Transfer and edit files right from your browser?
What you need is "ispy.cgi" - visit http://nisoftware.com/ispy.cgi
------------------------------
Date: Tue, 24 Apr 2001 01:01:06 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: Idiom: the expression of a copied & substituted string
Message-Id: <te9k2iiu7fqg92@corp.supernews.com>
John Lin <johnlin@chttl.com.tw> wrote:
> "John Joseph Trammell" wrote
>> John Lin wrote:
>> > I would like to learn the idiomatic way of expressing this:
>> >
>> > my $original = 'Good %, sir.';
>> > my $copied1 = 'Good morning, sir.'; # s/%/morning/;
>> > my $copied2 = 'Good afternoon, sir.'; # s/%/afternoon/;
>>
>> I don't know about idiomatic, but why not use [s]printf if the
>> substitution is that simple?
>>
>> my $template = "Good %s, sir.\n";
>> my $one = sprintf $template, "morning";
>> my $two = sprintf $template, "afternoon";
> Ho, ho, ho. Sorry, it twists my question.
How?
> Not a template problem.
No one said it was. It is a template problem, though. You are trying
to keep everything but a certain part of a string the same, while
replacing that part of the string. That's what templates do. The
function sprintf() takes a template as one of its arguments, and
is an idiomatic way of solving your problem.
> Another example is:
> my $original = 'hello-world.pl';
> rename $original => do { (my $dummy = $original) =~ s/\.pl$/.bak/; $dummy };
This is a mess. Try this:
my $original = 'hello-world.pl';
my $new = $original =~ s/\.pl$/.bak/;
rename $original, $new;
> Is there an idiomatic expression (shorter, cleaner) to say
> "The string that is made from replacing $original's '.pl' and end with '.bak'"
> (The do{} here is cumbersome.)
my $new = $original =~ s/\.pl$/.bak/;
Chris
--
Christopher E. Stith
Get real! This is a discussion group, not a helpdesk. You post
something, we discuss its implications. If the discussion happens to
answer a question you've asked, that's incidental. -- nobull, clp.misc
------------------------------
Date: Tue, 24 Apr 2001 08:54:15 +1000
From: "Michael R. McPherson" <hafateltec@hotmail.com>
Subject: Microsoft Access
Message-Id: <9c2bu402evh@enews1.newsguy.com>
First, I am only asking here because I couldn't find it anywhere else. (I
looked)
I need to query a Microsloth Access database on another server from
Linux/perl.
I am running smp redhat 6.2 kernel2.2.14-5.1 with perl 5.6
I have DBI installed.
Now what I am looking for is what modules I would need to connect and some
SIMPLE STRAIGHTFORWARD THIS IS HOW YOU DO IT kind of documentation on
DBD::ODBC with Microsloth Access.
Any help is greatly appreciated.
TYIA
--
##############Þ
print "\n Welcome to NEPP";$Þ=1;while ($Þ){
print "\n$Þ";$Þ++;if ($Þ == 1000) {
print "\n$Þ"."\nWell almost never ending :þ";exit;}}
##############Þ
------------------------------
Date: Tue, 24 Apr 2001 00:46:01 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Microsoft Access
Message-Id: <te9j69mvk55s13@corp.supernews.com>
Michael R. McPherson (hafateltec@hotmail.com) wrote:
: First, I am only asking here because I couldn't find it anywhere else. (I
: looked)
This is akin to the old joke about the drunk who loses his car keys in a
dark alley, but looks for them under a nearby streetlight because there's
more light there. :)
--
| Craig Berry - http://www.cinenet.net/~cberry/
--*-- "When the going gets weird, the weird turn pro."
| - Hunter S. Thompson
------------------------------
Date: Mon, 23 Apr 2001 23:01:47 -0400
From: Lyle Goldman <gizmo-p@erols.com>
Subject: Multi-Line Text Editor
Message-Id: <3AE4EC9B.7010003@erols.com>
Hello. Is there a Perl module that allows multi-line console-based text
editing that will work under Microsoft Windows? What I want is something
similar to the Curses packages but will run under Windows. It also must be
console-based, so Tk is no good. Thank you.
- Lyle Goldman
------------------------------
Date: Tue, 24 Apr 2001 02:56:03 GMT
From: tulask@hotmail.com (pat)
Subject: Please help
Message-Id: <Xns908CE0145tulask@24.215.0.21>
I've made several attempts at this file to no avil Please help
Create another Perl file named a1-q3.pl that contains: (6 marks)
a numerical array containing the numbers from 101 to 150
create and execute a function (or "subroutine") which will replace every
tenth item in the array with the word "tenth"
print the entire array on screen with 10 items printed per line and each
item separated with a comma and a space (", ")
pat@mountaincable.net
------------------------------
Date: 24 Apr 2001 03:05:20 GMT
From: anotherway83@aol.comnospam (The Mosquito ScriptKiddiot)
Subject: Re: Please help
Message-Id: <20010423230520.06044.00001170@ng-fo1.aol.com>
>I've made several attempts at this file to no avil Please help
>Create another Perl file named a1-q3.pl that contains: (6 marks)
er...the 6 marks part...is this sum test u're taking in a class...do the 6
marks mean 6 points for answering it?
peace
The Mosquito ScriptKiddiot
Championing the Cause of Mosquitoes in Technology
------------------------------
Date: Mon, 23 Apr 2001 22:42:46 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Please help
Message-Id: <slrn9e9q16.oft.tadmc@tadmc26.august.net>
pat <tulask@hotmail.com> wrote:
>I've made several attempts at this file to no avil Please help
Pick your best attempt, post the code here, and maybe we can
help you fix it up.
>Create another Perl file named a1-q3.pl that contains: (6 marks)
^^^^^^^^^^
Hmmm...
Why would you specify the _name_ of the program's file?
Strange.
>a numerical array containing the numbers from 101 to 150
>create and execute a function (or "subroutine") which will replace every
>tenth item in the array with the word "tenth"
>print the entire array on screen with 10 items printed per line and each
>item separated with a comma and a space (", ")
Golly, that sure does sound like a homework problem to me.
Doing it yourself will help you learn, which is why there is
homework in the first place.
Having us do it helps you not learn.
I'm not going to help you not learn.
Show us your code.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 24 Apr 2001 13:26:18 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Please help
Message-Id: <HA6F6.15$SR4.3287@vic.nntp.telstra.net>
"pat" <tulask@hotmail.com> wrote in message
news:Xns908CE0145tulask@24.215.0.21...
> I've made several attempts at this file to no avil Please help
> Create another Perl file named a1-q3.pl that contains: (6 marks)
>
>
> a numerical array containing the numbers from 101 to 150
> create and execute a function (or "subroutine") which will replace every
> tenth item in the array with the word "tenth"
> print the entire array on screen with 10 items printed per line and each
> item separated with a comma and a space (", ")
Looks suspiciously like homework to me. Maybe my sig will help you out...
<grin>
Wyzelli
--
my@a=(101..150);@a=c(@a);for(@a){if(m/[^\d]/){
print"$_\n"}else{print"$_, "}}sub c{for(1..@_){
next if($_%10);$_[$_-1]='tenth';}return @_;}
------------------------------
Date: 23 Apr 2001 23:50:17 -0400
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: Please help
Message-Id: <m3wv8bvtvq.fsf@mumonkan.sunstarsys.com>
tulask@hotmail.com (pat) writes:
> I've made several attempts at this file to no avil Please help
> Create another Perl file named a1-q3.pl that contains: (6 marks)
~~~~~~~
I can do it using only two marks ( well, three counting newlines :)
> a numerical array containing the numbers from 101 to 150
> create and execute a function (or "subroutine") which will replace every
> tenth item in the array with the word "tenth"
> print the entire array on screen with 10 items printed per line and each
> item separated with a comma and a space (", ")
% cat a1-q3.pl
.--.-..--..---.-.--..--.-..--..---.-.--.
-.--.--.-..----......-........-..---.--.
-.-.---.-.--.--.-.-..--..-..---.-..-.--.
--...--......-..-.----.......-..-...--..
....--..-...--...---.-...---.-..-...--..
-.-.--......--..--.---...-.-.....--..--.
.-..---.----.--..-...--..---.--.-..-.--.
..-.---..-.----....-.-........-..---.--.
-.-.---.-.--.--.-.-..--..-..---.-..-.--.
--...--.-..-.-..--.---...-.-.....-.-....
.-.-....--..---.-.-.---..-...--......-..
.--..--..-..---.----.--..-...--..---.--.
-..-.--...-.---..-.----......-..--.----.
.-.-.........-.......-...--..--.----.--.
.-..---......-.....-.-........-.-----.-.
-..-.-.......-..--.----..-.-.........-..
.....-.......-.......-....--.--.----.--.
--...--.-....--...--.--......-....-..-..
..---.-.--.---...-.-.........-.......-..
.....-.......-..-..-.--..--..--......-..
...-.-....-..-..-----.-......-..-.-..-..
.....-..-...--......--..-..-.-.......-..
--.----..-.-.........-.......-.......-..
.....-.......-.......-....-..-....---.-.
.....-..-.----.......-...-...-....--.-..
.....-...-...-..--.---...-.-.........-..
.....-.......-.......-..-.-----..-.-....
.....-.......-.......-.......-..-.-..--.
..--.--.--..---.-.-..--......-..--.----.
.-.-.........-.......-.......-.......-..
.....-.......-....-..-..-----.-......-..
-.----.......-...-...-....-.---.-.-..--.
.---.--...-.---....-.--..-...-..--.---..
.-.-.........-.......-.......-.......-..
.....-.......-....-..-....---.-......-..
-.----.......-...-...-....---.-..---.--.
.-...-..--.---...-.-.........-.......-..
.....-.......-..-.-----..-.-.....-.-....
.....-.......-.......-.......-......---.
.-..---.-..-.--..---.--...-.---.--.---..
.-.-.........-.......-..-.-----..-.-....
-.-----..-.-....
% perl -MMorse a1-q3.pl
101, 102, 103, 104, 105, 106, 107, 108, 109, tenth
111, 112, 113, 114, 115, 116, 117, 118, 119, tenth
121, 122, 123, 124, 125, 126, 127, 128, 129, tenth
131, 132, 133, 134, 135, 136, 137, 138, 139, tenth
141, 142, 143, 144, 145, 146, 147, 148, 149, tenth
HTH
--
Joe Schaefer "Everything that can be invented has been invented."
-- Charles H. Duell
------------------------------
Date: 23 Apr 2001 20:50:23 -0500
From: andrew_perrin@unc.edu (Andrew J. Perrin)
Subject: Re: pointer/reference question
Message-Id: <87itjvhxr4.fsf@nujoma.perrins>
xris <xris@dont.send.spam> writes:
> and in answer to the aforementioned "$x=$y" thing, that copies the data,
> not the reference.
Um, no, it doesn't:
main::(-e:1): 1
DB<1> $foo= 'foo' # the value 'foo' is now stored in $foo.
DB<2> $y = \$foo # the location of 'foo' is now in $y.
DB<3> print $y # note that $y is a SCALAR ref, pointing to
SCALAR(0x820b9f4) # address 0x820b9f4...
DB<4> print $$y # ...and that the value stored at that address
foo # is 'foo'.
DB<5> $x = $y # now assign the contents of $y to $x. But remember
# $y is a REFERENCE; it doesn't contain 'foo' but
# a pointer thereto.
DB<6> print $x # let's check. Yes indeed - $x is now a reference to
SCALAR(0x820b9f4) # the SAME memory as that to which $y points: 0x820b9f4.
DB<7> print $$x # and, unsurprisingly, that address still holds 'foo'.
foo
Now, it remains entirely possible (even likely) that I misunderstand
what you're asking for, since you're referring to C++ which I don't
know. But on the narrow point, I believe I'm right: when $y is a
reference, setting $x = $y copies the reference into $x. To wit, the
following illustration:
DB<8> $$y = 'bar'
DB<9> print $$x
bar
Clearly, if the data ('foo') had been copied from $$y to $$x back in
line DB<5>, setting $$y to 'bar' would have no effect on $$x. Yet it
does.
Cheers,
Andy
--
----------------------------------------------------------------------
Andrew J Perrin - Ph.D. Candidate, UC Berkeley, Dept. of Sociology
(Soon: Asst Professor of Sociology, U of North Carolina, Chapel Hill)
andrew_perrin@unc.edu - http://www.unc.edu/~aperrin
------------------------------
Date: 24 Apr 2001 02:57:43 GMT
From: gorilla@elaine.furryape.com (Alan Barclay)
Subject: Re: Problem with associative array--what am I doing wrong here?
Message-Id: <988081055.767395@elaine.furryape.com>
In article <9c1vu1$41c@nntpa.cb.lucent.com>,
Bill Weissborn <bweissbo@lucent.com> wrote:
>> You should always, yes *always*, check the return value from open():
>
>Production code, definitely....proof-of-concept type stuff....I don't think
>so....especially when I "KNOW" the file is there and readable.
At least 50% of the time you "KNOW" the file is there and readable, it isn't.
This rises to 99% if you post to clpm about the program not working.
------------------------------
Date: Mon, 23 Apr 2001 22:12:37 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: readdir command
Message-Id: <3AE4A8D6.D45AD4CE@acm.org>
Kerstin Rapp wrote:
>
> I'm trying to use readdir. It goes into a foreach loop and is supposed to
> print and then copy the found files if they have a certain extension.
>
> Everything works - just it iterates through the directory 95 times and
> therefore tries to execute the command 95 times (what is very annoying).
>
> I tried shift, push, etc. what didn't make any difference.
>
> What am I doing wrong?
Please post the code that demonstrates the problem (copy and paste it
from your actual code.)
John
--
use Perl;
program
fulfillment
------------------------------
Date: Mon, 23 Apr 2001 22:56:33 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: RegEx optimization assistance
Message-Id: <9qc9etk3ourg8n9luvtkrsj40dk572g817@4ax.com>
John W. Krahn wrote:
>Try something like this.
>while ( <TESTFILE> ) {
> if ( /\bfree\b/ ) {
> my @keys = split " ";
> @stats{ @keys } = split " ", <TESTFILE>;
> }
> }
Won't do. The problem is that he wants to extract some data on the *next
line* following the line containing the word "free".
--
Bart.
------------------------------
Date: Mon, 23 Apr 2001 23:35:06 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: RegEx optimization assistance
Message-Id: <3AE4BC29.131798BD@acm.org>
Bart Lateur wrote:
>
> John W. Krahn wrote:
>
> >Try something like this.
>
> >while ( <TESTFILE> ) {
> > if ( /\bfree\b/ ) {
> > my @keys = split " ";
> > @stats{ @keys } = split " ", <TESTFILE>;
> > }
> > }
>
> Won't do. The problem is that he wants to extract some data on the *next
> line* following the line containing the word "free".
Just for _you_ Bart I went back and tested it with the OP's original
data.
my %stats;
while ( <DATA> ) {
if ( /\bfree\b/ ) {
my @keys = split " ";
@stats{ @keys } = split " ", <DATA>;
}
}
print "Free: $stats{free} In: $stats{in}\n";
__DATA__
TimeStamp: 2001 095 00 05 01 4 Thu Apr 05
VM
memory page faults
avm free si so pi po fr de sr in sy cs
21996 203131 0 0 0 0 9 0 0 3054 27087 806
CPU
cpu procs
us sy id r b w
17 3 80 2 0 0
18 4 78
18 4 78
17 4 79
20 7 73
21 11 69
__END__
Free: 203131 In: 3054
John
--
use Perl;
program
fulfillment
------------------------------
Date: Mon, 23 Apr 2001 23:39:01 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: RegEx optimization assistance
Message-Id: <i8f9etk4rlc967tdi3o8mg82sp1fhvrkqq@4ax.com>
John W. Krahn wrote:
>while ( <DATA> ) {
> if ( /\bfree\b/ ) {
> my @keys = split " ";
> @stats{ @keys } = split " ", <DATA>;
^^^^^^
Oh yeah. Of course. Bugger. In fact, that store-data-into-hash idea is
very neat.
--
Bart.
------------------------------
Date: Mon, 23 Apr 2001 22:06:36 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: regular expression question
Message-Id: <3AE4A76D.39D6E9BE@acm.org>
Steve wrote:
>
> >for "match all characters including and within the specified tags".
> >
> >And then the whitespace [:space:] or \s
>
> Something like tr/\s+/\s/;
tr does not use regular expressions so this will not work like you
think.
$ perl -e '$_ = "test \\+ \\s test \+ \s test\n"; print; tr/\s+/\s/;
print;'
test \+ \s test + s test
test \s \s test s s test
John
--
use Perl;
program
fulfillment
------------------------------
Date: Mon, 23 Apr 2001 21:22:56 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: US$50 prize for hash failure from 'delete' inside an 'each' loop
Message-Id: <Q21F6.18137$Ce4.1644541@news1.rdc1.ct.home.com>
In comp.lang.perl.misc Mark-Jason Dominus <mjd@plover.com> wrote:
> The 'perlfunc' man page says:
> each ...
>
> If you ... delete elements of a hash while you're
> iterating over it, you may get entries skipped or
> duplicated...
> I will give a $50 prize to the first person who can come up with an
> example that demonstrates this.
I'm close to 100% sure that this can't happen with a plain hash. I
would say that all bets are off with a ties one, however.
Dan
------------------------------
Date: Mon, 23 Apr 2001 23:26:17 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: US$50 prize for hash failure from 'delete' inside an 'each' loop
Message-Id: <te9egpa7p70a39@corp.supernews.com>
Dan Sugalski (dan@tuatha.sidhe.org) wrote:
: In comp.lang.perl.misc Mark-Jason Dominus <mjd@plover.com> wrote:
: > I will give a $50 prize to the first person who can come up with an
: > example that demonstrates this.
:
: I'm close to 100% sure that this can't happen with a plain hash. I
: would say that all bets are off with a ties one, however.
I've always seen this as wiggle room left for future implementors. In
other words, even if it's impossible with current hashes, there's no
guarantee it will stay that way, so you shouldn't write code that depends
on it.
--
| Craig Berry - http://www.cinenet.net/~cberry/
--*-- "When the going gets weird, the weird turn pro."
| - Hunter S. Thompson
------------------------------
Date: Mon, 23 Apr 2001 15:45:32 -0700
From: "igor' spivak" <igor.spivak@intrinsic.com>
Subject: web log parsing
Message-Id: <9c2bdj$34o$1@paxfeed.eni.net>
hey, anyone know of a good script to parse apache or combined logs? i mainly
need the reg.exps, the rest is easy,
thanks,
ids
------------------------------
Date: Mon, 23 Apr 2001 23:37:26 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Where is my script
Message-Id: <te9f5mtgkd4q32@corp.supernews.com>
Martin Djernaes (martin@djernaes.net) wrote:
: Did I understand FindBin correctly if it doesn't work if I use 'perl
: myscript.pl' when calling! It it "just" looking at the path - doesn't
: perl offer this information to the script itself?
It discovers the true filesystem path at which the script resides. It
works either for a script with the right #! line run as an executable
script, or for a script invoked as 'perl <name>'. And yes, perl (and the
OS) do make this info available, but it's less than convenient to use the
data as they offer it, sometimes. FindBin is a convenience wrapper.
--
| Craig Berry - http://www.cinenet.net/~cberry/
--*-- "When the going gets weird, the weird turn pro."
| - Hunter S. Thompson
------------------------------
Date: Tue, 24 Apr 2001 00:06:37 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: Which is faster/better?
Message-Id: <GC9sB1.9AJ@news.boeing.com>
In article <xris-2EAC61.19352421042001@news.evergo.net>,
xris <xris@dont.send.spam> wrote:
>The perl book talks about using join() instead of a sequence of
>concatenated strings, but doesn't really say much more than that, so my
>question is, which is faster?
>
>a) $str = join('', $s1, $s2, ..., $sx);
>
>b) $str = $s1;
> $str .= $s2;
> ...
> $str .= $sx;
>
>c) $str = $s1 . $s2 . ... $sx;
>
>d) $str = "$s1$s2...$sx";
>
>??
>
>I'm not only interested in which is faster, but also which performs
>better under large-string circumstances. I've had join() die on my a
>few times because I was trying to join three VERY large strings.
>
>I'm also particularly interested in the speed differences between b and
>c. I know that technically c should run faster since it's one command
>as opposed to several, but is the .= command faster than, say, doing
>something like
>
> $str = $str . $suffix; ??
>
>same goes for something like:
>
> substr($str, 0, 0) = $prefix; ??
>
>--
>
>I've been programming in perl for over 6 years now, and tend to use
>whatever looks cleanest, but being an efficiency nut, I'd really like to
>know the differences between all of these ways of doing things. Plus,
>I'm sure it might help out some novices to learn from my own mistakes.
>:)
>
You could construct various sized strings dynamically using
parameters from command line and then roll your tests with
the Benchmark module.
perldoc Benchmark
Or do a net search for Benchmark. You'll find many threads
about this.
hth,
--
Charles DeRykus
------------------------------
Date: Tue, 24 Apr 2001 00:03:16 GMT
From: ixlu@PCGuide.com (Charles M. Kozierok)
Subject: Re: Windows Perl for Windows 95 -- Internet Explorer 5 required?
Message-Id: <8p3F6.389$Be3.37736@news.shore.net>
In article <qev8etc1eqk76u3kre4prq77eb3ev1ul4k@4ax.com>,
Bart Lateur <bart.lateur@skynet.be> wrote:
} Charles M. Kozierok wrote:
}
} >Is Indigo as "good as" ActiveState, which seems to be the usual
} >"default" recommendation?
}
} What I means is that it is actually binary compatible with it. Not only
} is it a Perl of the same version, it is likely even built from the same
} source, and even modules that use a custom DLL, written and compiled for
} Activestate, can be used by IndigoPerl.
}
} And yes, it's "as good as" Activestate. I think. I use it all the time.
} So I can't really compare. ;-)
Thanks Bart. I'll give Indigo a try. If you have any tips or pitfalls
to help a newbie avoid, please share them. :)
cheers,
-*-
Charles M. Kozierok (mailto:ixl@PCGuide.com)
Webslave, The PC Guide - <http://www.PCGuide.com>
Comprehensive PC Reference, Troubleshooting, Optimization and Buyer's Guides...
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.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 V10 Issue 750
**************************************