[9637] in Perl-Users-Digest
Perl-Users Digest, Issue: 3231 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jul 23 08:07:47 1998
Date: Thu, 23 Jul 98 05:01:14 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 23 Jul 1998 Volume: 8 Number: 3231
Today's topics:
Re: 'eval' and 'require' - sorry - its a known bug! <mgregory@asc.sps.mot.com>
delete while iterating over array dwiesel@my-dejanews.com
Re: delete while iterating over array (Juergen Heinzl)
Re: delete while iterating over array (Tad McClellan)
emacs environment <derrendinger@ito.umnw.ethz.ch>
exec return ? <kamrani@ifi.uio.no>
File File Creation date <simon.ross@baesema.co.uk>
Re: Finding new files (create after a time stamp) (Nitin G. Mule g)
format report blank line in output <ryan@steelplan.com.au>
Re: has anyone attempted a script that can replicate it <Tony.Curtis+usenet@vcpc.univie.ac.at>
Re: Hash tree problems. (M.J.T. Guy)
Re: Help! Memory leak in code! (I think) (Stefaan A Eeckels)
Re: How to know the number of hash items without runnin (Craig Berry)
Re: How to know the number of hash items without runnin <Borre.Fjeldso@ericsson.no>
Re: How to send the e-mail by attractment <quednauf@nortel.co.uk>
Re: im having trouble with a bit of perl script, if som merzky@my-dejanews.com
Re: Installation of Perl V5.004_04 on IBM AIX V4.2 <dhm@ficsgrp.com>
Re: Is Perl y2k compliant? dave@mag-sol.com
is there a isNumber($aString) function? dwiesel@my-dejanews.com
Re: is there a isNumber($aString) function? <qdtcall@esb.ericsson.se>
Re: is there a isNumber($aString) function? (David Cantrell)
Re: is there a isNumber($aString) function? (Tad McClellan)
Re: novice Q; reading columns of numbers (Bart Lateur)
Perl and TTY Cursors Library <wayne@misinfo.com.au>
Perl for Embedded Systems? Misc Qestions... <wd@uebemc.siemens.de>
Re: Perl for Embedded Systems? Misc Qestions... <wd@uebemc.siemens.de>
Q:Newbie-Howto: Embedded WIN32-Perl in a DLL (Hermann Flacke)
References as strings <hakjo733@student.liu.se>
Re: regexp vs. split merzky@my-dejanews.com
sendmail code <matthew@nofear.hjsoft.com>
Re: STUMPED!!! (perl trivia) <NOSPAMkEynOn@panix.comNOSPAM>
Re: The act of glueing one cat's nose to another's tail (Jeffrey R. Drumm)
Re: The act of glueing one cat's nose to another's tail (M.J.T. Guy)
Re: the low road <jkramer@primenet.com>
Re: the low road (M.J.T. Guy)
Re: Variable Interpolation <quednauf@nortel.co.uk>
Re: W32 Port scott@softbase.com
what is the difference between "tie" & "dbmopen"? <sschng6@ie.cuhk.edu.hk>
Re: Win32 - SMTP <jimbo@soundimages.co.uk>
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 23 Jul 1998 09:53:45 +0930
From: Martin Gregory <mgregory@asc.sps.mot.com>
Subject: Re: 'eval' and 'require' - sorry - its a known bug!
Message-Id: <r8hg09mn3i.fsf@asc.sps.mot.com>
I've had a number of replies to this post that indicate that my
question was not clear enough:
I <mgregory@asc.sps.mot.com> wrote:
> How come I can't use eval to test require?
>
> I have this code:
>
[see below]
> .. and I get
>
> [djarraba-mg]{jenna} foo.pl
> foo did not return a true value at /home/mgregory/bin/foo.pl line 8.
> [djarraba-mg]{jenna}
>
>
> when I have an empty "foo" file.
Here is the code, with some comments added:
eval '(exit $?0)' && eval 'exec perl -w -S $0 ${1+"$@"}' # -*- Perl -*-
& eval 'exec perl -w -S $0 $argv:q'
if 0;
eval 'require "foo";'; # line 5
!$@ or die "ERROR: perl couldn't parse foo: $@\n"; # line 6
require "foo"; # line 8
The question is
"How come the eval at line 5 doesn't cause the die at line 6 to be called,
yet the require at line 8 fails?"
The answer is that this is a bug that is fixed in the current betas of
perl - embarrasingly, I found this out _last time_ I asked this
question here, but forgot all about it!
Martin.
------------------------------
Date: Thu, 23 Jul 1998 10:32:29 GMT
From: dwiesel@my-dejanews.com
Subject: delete while iterating over array
Message-Id: <6p73ft$a71$1@nnrp1.dejanews.com>
Hi,
I have an array where some keys are empty ( "" ). How do I do to delete them?
I understand that I can't use splice when iterating over the array.
Any suggestions?
// Daniel
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: 23 Jul 1998 11:08:19 GMT
From: juergen@lth330dn.sbs.de (Juergen Heinzl)
Subject: Re: delete while iterating over array
Message-Id: <slrn6re6jg.op8.juergen@lth330dn.sbs.de>
In article <6p73ft$a71$1@nnrp1.dejanews.com>, dwiesel@my-dejanews.com wrote:
>Hi,
>
>I have an array where some keys are empty ( "" ). How do I do to delete them?
>I understand that I can't use splice when iterating over the array.
>
>Any suggestions?
FIX ME: won't work, but how about this ...
@tmp = ();
map {
push @tmp,$_ if $_ ne '';
} @array;
@array = @tmp;
... and if you do it within a function with @tmp a 'my' variable no waste
of space or ...
$i = 0;
map {
$array[$i++] = $_ if $_ ne '';
} @array;
##
# resize array
$#array = $i - 1 if $i != 0;
...
Just two ideas,
Juergen
--
\ Real name : J|rgen Heinzl \
\ Email (office ) : idoinet@sbs.de \
\ Email (private) : unicorn@noris.de \
\ Phone (private) : +49 911-4501186 \
------------------------------
Date: Thu, 23 Jul 1998 06:37:25 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: delete while iterating over array
Message-Id: <l977p6.aqe.ln@localhost>
dwiesel@my-dejanews.com wrote:
: I have an array where some keys are empty ( "" ). How do I do to delete them?
: I understand that I can't use splice when iterating over the array.
: Any suggestions?
I assume you mean a real array (@array) and not a hash.
Your use of "key" is confusing...
@array = grep /./s, @array; # eliminate empty array elements
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 23 Jul 1998 13:39:51 +0200
From: Luc Derrendinger <derrendinger@ito.umnw.ethz.ch>
Subject: emacs environment
Message-Id: <35B72107.E9FCAC97@ito.umnw.ethz.ch>
Hi,
I tried to run perl under emacs, with a script containing the
<STDIN> input, but
I can not make it work. Does anybody have an idea how to?
Thanks for any info,
Luc
------------------------------
Date: Thu, 23 Jul 1998 09:54:59 +0200
From: Kamran Iranpour <kamrani@ifi.uio.no>
Subject: exec return ?
Message-Id: <35B6EC53.2773@ifi.uio.no>
Hei
Does "exec" and "system" return any value, i.e. 0 or 1 ?
Another question is I like to store the output of the
exec in a variable. I have the following line in my program:
exec("rsh $machine hosttype");
which opens a shell on a remote machine and execute the
the hosttype command. Lets say the output is sgi, standing
for silicon graphics. I want to assign this to a text
variable. How should I do it ?
Thanks in advance
Kamran
------------------------------
Date: Thu, 23 Jul 1998 12:20:33 +0100
From: "Simon Ross" <simon.ross@baesema.co.uk>
Subject: File File Creation date
Message-Id: <35b71be4.0@nnrp1.news.uk.psi.net>
Greetings
This may have been answered many times before but I can't find a referance
to it.
I am using the stat() function to get the file creation date on certain
files. This works fine however the displayed month is always a month behind
the real creation date. I am using version 5.003_07 on a WindowsNT machine.
Can anybody help ???
Simon Ross
simon.ross@baesema.co.uk
------------------------------
Date: Wed, 22 Jul 1998 21:31:00 GMT
From: mule2251@mach1.wlu.ca (Nitin G. Mule g)
Subject: Re: Finding new files (create after a time stamp)
Message-Id: <EwIMFp.4vv@info.uucp>
drubin@gatekeeper.cb.att.com wrote:
: Hello,
:
: What is the best way (using ksh or perl) to find all files in a directory
: created after a timedate stamp (such as 07/20/98:10:10)? I was hoping this
: would be simple, but I keep coming up with very messy solutions.
:
: Thanks for any suggestions.
:
: - Dan
See if this helps you. The time stamp for touch should be in mmddhhmmyy
format.
touch 0722171598 /tmp/tmp.$$
find . -newer /tmp/tmp.$$ -print
rm /tmp/tmp.$$
--
'''''''''''''''''''''''''''''''''''''''''''''''''
Nitin Mule mule2251@mach1.wlu.ca
Wilfrid Laurier University, Waterloo, ON, Canada
"````````R U still looking for a quote?`````````"
------------------------------
Date: Thu, 23 Jul 1998 17:16:56 +0800
From: Ryan Snowden <ryan@steelplan.com.au>
Subject: format report blank line in output
Message-Id: <35B6FF88.2D1D2A87@steelplan.com.au>
I have a little test script im writing to check out 'format' in creating
reports. It looks like dis:
format REPORT =
@|||| @||| @|||||||||||||||||||||| @||| @| @|
@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$j, $t, $recipient, $sdr, $s, $r, $firstline
.
open(REPORT, ">data-to-print") || die "can't create";
print REPORT "Job | TQ | Receiver | Sender | S | R |
Firstline of Message\n";
print REPORT "-" x 100;
open(FILE, "file.txt") || die "cannot open file.txt";
while (<FILE>) {
chomp;
($j,$t,$recipient,$sdr,$s,$r,$firstline) = split (/:/);
write (REPORT);
}
close(FILE);
print "REPORT";
close(REPORT);
It's output looks like this:
Job | TQ | Receiver | Sender | S | R | Firstline of
Message
----------------------------------------------------------------------------------------------------
1671 001 ryan@company.com.au RAS N Y This is the first
line of the message
1700 007 ryan@company.com.au AL N Y This is the first
line of the message
__
How do i get rid of the blank lines between each record?
------------------------------
Date: 23 Jul 1998 08:18:27 +0200
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: has anyone attempted a script that can replicate itself and then run the copy?
Message-Id: <7xn2a1gkek.fsf@fidelio.vcpc.univie.ac.at>
text
Newsgroups: comp.lang.perl.misc
Subject: Re: has anyone attempted a script that can replicate itself and then run the copy?
References: <6p5p5u$qes$1@nnrp1.dejanews.com>
text
------------------------------
Date: 23 Jul 1998 11:02:56 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Hash tree problems.
Message-Id: <6p7590$kqf$1@pegasus.csx.cam.ac.uk>
Ronald J Kimball <rjk@coos.dartmouth.edu> wrote:
>Michael Bowler <mkbowler@nortel.com> wrote:
>
>> I am having problems with checking for existence of keys down non-existent
>> branches in a hash tree, causing those branches to be created. Is this how
>> perl is supposed to handle this?
>
>Well, the documentation seems to think so...
Not _exactly_.
>perlref:
>
> References of the appropriate type can spring into existence if you
> dereference them in a context that assumes they exist. Because we
> haven't talked about dereferencing yet, we can't show you any
> examples yet.
>
>[...]
>
> $array[$x]->{"foo"}->[0] = "January";
>
> This is one of the cases we mentioned earlier in which references
> could spring into existence when in an lvalue context.
^^^^^^
Michael's examples were in rvalue context. It's generally considered
a bug that things sometimes get autovivified in rvalue context, such
as the argument to exists(). This may be mended some day.
Mike Guy
------------------------------
Date: 23 Jul 1998 10:54:42 GMT
From: Stefaan.Eeckels@ecc.lu (Stefaan A Eeckels)
To: Rik Blok <blok@physics.ubc.ca>
Subject: Re: Help! Memory leak in code! (I think)
Message-Id: <6p74pi$1co$1@justus.ecc.lu>
[Posted and mailed.]
In article <35B6B2A8.B631E885@physics.ubc.ca>,
Rik Blok <blok@physics.ubc.ca> writes:
> This is a multi-part message in MIME format.
Please don't post MIME. It really scrambles the display
on many news readers, and ensures that the real gurus
won't even look at your post (so you're stuck with me ;-)
>
> I hope somebody can help me. I'm running the attached code I have
> written with Perl 5.00402 for Win32 but it keeps locking up my system.
> Must be a memory leak right? Anyways, I'm a newbie (been using Perl a
> couple weeks now) and I am *WAY* over my head with this code.
Why should it be a memory leak? Are you running this on Win95 or
WinNT? If you didn't run it on NT, try that and see if it leaks
memory with the Task Manager (there might be a similar utility on
Windows95 but I don't use Windows95; there are limits ;-).
>
> Could somebody take a quick look at it and let me know if I'm doing
> anything obviously wrong or dangerous?
You could try to add '#!/usr/bin/perl -w' to all your source
files. I know it doesn't work in Windows, but Perl will honour
the flags, and give you useful information such as:
:Name "main::filenotfound" used only once: possible typo at BuildProb.pl line 16.
:Value of <HANDLE> construct can be "0"; test with defined() at ReadData.pl line 65535.
:sh: C:\My Documents\CBuilder\Projects\ChooseFile\ChooseFile.exe: command not found
:Couldn't open file for output: No such file or directory at BuildProb.pl line 36.
:Saving results...
> The program file is
> "BuildProb.pl" (I've also attached the included files) and it crashes at
> arbitrary (and inconsistent) points (like between "flag 2" and "flag 3"
> in the first loop.
Does it crash after processing one file, or more files (it's
unlikely to be a leak unless you process a significant number
of files). The fact that it crashes on a 'close' seems to
indicate that your file handle might be suspect (see the warning
above).
>
> Any help would be appreciated. Sorry for the big code but I can't
> really break it down any further...
You really should try to isolate the various routines
(like reading the SPS file into the array) and test these
individually for leaks; try to test on a Unix platform using
the latest stable version (5.004_04) and see if they are OK
(Linux is quite nice because you can watch both memory and
file handle leakage through /proc). I've noticed that
Win32 Perl isn't as stable as Unix Perl, and leaks handles
when using the Net modules; your problem might be related.
BTW, I couldn't run your code because I don't have data files
nor the ChooseFile.exe program you call.
HTH
--
Stefaan
--
PGP key available from PGP key servers (http://www.pgp.net/pgpnet/)
___________________________________________________________________
Perfection is reached, not when there is no longer anything to add,
but when there is no longer anything to take away. -- Saint-Exupery
------------------------------
Date: 23 Jul 1998 07:13:48 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: How to know the number of hash items without running loop.
Message-Id: <6p6nrc$3gk$2@marina.cinenet.net>
yroh (yroh@samsung.co.kr) wrote:
: Without running loop, is there way to count how many items the hash has?
scalar keys %hash;
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| Member of The HTML Writers Guild: http://www.hwg.org/
"Every man and every woman is a star."
------------------------------
Date: 23 Jul 1998 12:04:53 +0200
From: =?ISO-8859-1?Q?B=F8rre_Fjelds=F8?= <Borre.Fjeldso@ericsson.no>
Subject: Re: How to know the number of hash items without running loop.
Message-Id: <gvl90lkevcq.fsf@eto.ericsson.se>
mick@io.com (Michele Beltrame) writes:
> Hi yroh <yroh@samsung.co.kr>!
>
> >Without running loop, is there way to count how many items the hash has?
>
> You can use something like:
>
> @hkeys = keys(%myhash);
> $numitems = $#hkeys;
Which is not the number of elements but the index of the last position
in the array.
Try
$numitems = scalar keys %myhash;
instead
//Bxrre
--
Bxrre Fjeldsx - bgf@dod.no - Honda VFR750 - Dod# daf - NMCU #26215
One word sums up probably the responsibility of any vice president, and
that one word is "to be prepared." -- Dan Quayle
------------------------------
Date: Thu, 23 Jul 1998 10:16:51 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: How to send the e-mail by attractment
Message-Id: <35B6FF82.A9DD28B3@nortel.co.uk>
Bug wrote:
Re: How to send the e-mail by attractment
^^^^^^^^^^^
Attractment as in attraction? Do you want to write nice, attractive
emails? Then I suggest you find some poetry newsgroups or read my
stories to give you an inspiration :o^)
If you mean attachment, then you could try my webpage anyway which has
got something on sending attachments. Feel free to ask me in case you
don't understand anything, so that I can improve the comments.
--
____________________________________________________________
Frank Quednau
http://www.surrey.ac.uk/~me51fq
________________________________________________
------------------------------
Date: Thu, 23 Jul 1998 09:33:31 GMT
From: merzky@my-dejanews.com
Subject: Re: im having trouble with a bit of perl script, if someone could give me a hand
Message-Id: <6p701b$68q$1@nnrp1.dejanews.com>
In article <6p5c1n$9gs$1@nnrp1.dejanews.com>,
jhestyr@my-dejanews.com wrote:
> the idea of the program is to make x directories then randomly choose one,
> change to that dir, then make x more directories, and so forth until the loop
> runs out
>
> heres what i have:
>
> $prog=1;
> $dir=1;
> mkdir('temp', 0777);
> chdir('temp');
> while($prog <= 3){
> until($dir == 4) {
> print "dir = $dir\n";
> print "prog = $prog\n";
> mkdir("$dir", 0777);
> $dir++;
> }
> srand();
> $randnum = int( rand(3) ) + 1;
> chdir("$randnum");
> $prog++;
> print "prog = $prog\n";
> }
>
> but after fulfilling the nested until command, it moves onto the random
> funtion, and then exits the loop. mebbe putting a line: $count = 1 after the
> $prog++ ?>??
this should work..:)
#!/usr/bin/perl -w
use strict;
my ($prog) = 1;
my ($randnum) = 0;
mkdir ('/tmp/test/temp', 0777);
chdir ('/tmp/test/temp');
while($prog <= 4){
>>>my ($dir) = 1; # you should reset $dir..:-)
my ($test) = 0;
until($dir == 4) {
print "dir = $prog - $dir\n";
mkdir("$dir", 0777);
$dir++;
}
srand();
$randnum = int( rand(3) ) + 1;
print "going to change to dir '$randnum'\n";
chdir ("$randnum") or warn "cannot chnge to $randnum!\n";
$prog++;
print "prog = $test - $randnum - $prog\n";
system ("pwd");
}
Andre.
> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
>
--
Andre Merzky
pinocchio@earthling.net
http://pino.home.pages.de/
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Thu, 23 Jul 1998 12:12:31 +0200
From: Daniel Hams <dhm@ficsgrp.com>
To: "Gary K. Waugaman" <waugie@ibm.net>
Subject: Re: Installation of Perl V5.004_04 on IBM AIX V4.2
Message-Id: <35B70C8F.36BDA108@ficsgrp.com>
When running configure, try resetting it to _not_ use nm to extract
symbols from libs.
AIX nm seems to be a bit pants and socks.
Mr Thinly Sliced.
Gary K. Waugaman wrote:
>
> I'm a Perl neophyte. I'm attempting to install Perl5.004 because the DBI
> interface that we are trying to install does not run on our Perl5.002
> level. I'm not the installer of the 5.002 level. My system is a RS6000
> running AIX.
>
> Anyway, I accepted all the defaults for sh Configure and this is what I
> got from make....
>
> AutoSplitting perl library
------------------------------
Date: Thu, 23 Jul 1998 08:07:25 GMT
From: dave@mag-sol.com
Subject: Re: Is Perl y2k compliant?
Message-Id: <6p6qvt$v23$1@nnrp1.dejanews.com>
In article <35B64E8B.6B36D28E@att.com>,
"Victor O." <vonyemelukwe@att.com> wrote:
> Hello All,
>
> Is Perl y2k?
What part of the answer to perlfaq4 "Does Perl have a year 2000 problem?"
don't you understand?
Dave...
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Thu, 23 Jul 1998 08:58:13 GMT
From: dwiesel@my-dejanews.com
Subject: is there a isNumber($aString) function?
Message-Id: <6p6tv5$3np$1@nnrp1.dejanews.com>
Hi,
How can I tell if a string (e.g. "7945797945") is a number or not?
// Daniel
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: 23 Jul 1998 11:27:07 +0200
From: Calle Dybedahl <qdtcall@esb.ericsson.se>
Subject: Re: is there a isNumber($aString) function?
Message-Id: <isu348gbo4.fsf@godzilla.kiere.ericsson.se>
dwiesel@my-dejanews.com writes:
> How can I tell if a string (e.g. "7945797945") is a number or not?
By reading the FAQ.
--
Calle Dybedahl, UNIX Sysadmin
qdtcall@esavionics.se http://www.lysator.liu.se/~calle/
------------------------------
Date: Thu, 23 Jul 1998 11:42:16 GMT
From: NukeEmUp@ThePentagon.com (David Cantrell)
Subject: Re: is there a isNumber($aString) function?
Message-Id: <35b72143.7147627@thunder>
On Thu, 23 Jul 1998 08:58:13 GMT,
dwiesel@my-dejanews.com enlightened us thusly:
>Hi,
>
>How can I tell if a string (e.g. "7945797945") is a number or not?
By using regexes. You could define an isNumber() subroutine which
used them internally if you find yourself doing this a lot.
--
David Cantrell, part-time NT/java/SQL techie
full-time chef/musician/homebrewer
http://www.ThePentagon.com/NukeEmUp
------------------------------
Date: Thu, 23 Jul 1998 06:43:39 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: is there a isNumber($aString) function?
Message-Id: <bl77p6.aqe.ln@localhost>
dwiesel@my-dejanews.com wrote:
: How can I tell if a string (e.g. "7945797945") is a number or not?
By first defining what you mean by "number".
And second by reading the answer to your Frequently Asked Question
in the Perl Frequently Asked Question list (part 4)
"How do I determine whether a scalar is a number/whole/integer/float?"
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 23 Jul 1998 11:54:57 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: novice Q; reading columns of numbers
Message-Id: <35bdfb66.4675984@news.tornado.be>
I haven't actually delved into the details of your problem :-), BUT I
did spot something that you should never do. The subpattern and the
question mark clash. I find that the result it gives, is rather
unintuitive, so you should avoid it at all times.
isifuelo@my-dejanews.com wrote:
>I'm trying to match...
>(\d(\d)?)/(\d(\d)?)/(\d\(d)?)\s([0-9]+(\.[0-9]*)?)\s([0-9]+(\.[0-9]*)?)\s([0-
>9]+(\.[0-9]*)?)\s([0-9]+(\.[0-9]*)?)\s([0-9]*)
Ok, this is it: you use "(\d(\d)?)". You should never use a question
mark outside parentheses. So, use "(\d(\d?))", or "(\d(?:\d?))" (or even
"(\d\d?)") if you don't need the value.
BTW I don't think there's anything wrong with the construct:
(?: .... )?
Oops, I just spotted another error: "(\d\(d)?)" (third group). There's a
backslash missing.
Bart.
------------------------------
Date: Thu, 23 Jul 1998 16:41:19 +1000
From: Wayne Blick <wayne@misinfo.com.au>
Subject: Perl and TTY Cursors Library
Message-Id: <35B6DB0F.F3F@misinfo.com.au>
Hi,
Does anyone know where I can find some more detailed doco on the use of
the cursors library? The distribution on CPAN assumes you already know
how to use cursors and now just want to do ot from Perl.
Thanks,
Wayne Blick
------------------------------
Date: 23 Jul 1998 09:04:19 GMT
From: Wolfgang Denk <wd@uebemc.siemens.de>
Subject: Perl for Embedded Systems? Misc Qestions...
Message-Id: <6p6uaj$q5o$1@galaxy.mchh.siemens.de>
Keywords: Perl, Embedded Sytems, LynxOS
Hi,
is there anybode using Perl in Embedded Systems? I've looked through
the FAQ's and Web pages, but found no or only very few information...
What I'm trying to do is to implement some network (Web) based
services on an Embedded System running the Real-Time UNIX `LynxOS'
(see www.lynx.com). The CPU is a Motorola 860, which has a PowerPC
core, but no FPU.
Perl 5.004_04 can be build on this system (with a few minor test
failing), and I even can install most of the modules, I even got LWP
running (with some problems, too).
A few questions:
* Is there somebody else working in a similar (restricted)
environment, and willing to discuss experiences etc.?
* Is there sombody feeling responsible for the LynxOS port of Perl,
for instance to fix problems with this special port, or to improve
it for instance by supporting shared libraries and dynamic loading?
* Is there a way to automatically install modules that need static
linking using the CPAN interface? For instance, when I try to use
just `install MD5' from within a CPAN shell, I see the messages
To install the new "perl" binary, call
make -f Makefile.aperl inst_perl MAP_TARGET=perl
but I have do execute this command by hand. A "feature" in CPAN.pm?
* Since my CPU has no FPU, everything in Perl is quite ... slow. I
know that it can help a bit to `use integer;' within my own
scripts. Is there a way to do this on a general base? I think this
would most probably break some of the standard modules from the
CPAN? Any ideas what to do?
All comments welcme - thanks in advance,
Wolfgang Denk
--
Office: (+49)-89-722-27328, Fax -36703 Wolfgang.Denk@oen.siemens.de
Private: (+49)-89-95720-110, Fax -112 wd@denx.muc.de
It's not an optical illusion, it just looks like one. -- Phil White
------------------------------
Date: 23 Jul 1998 10:32:37 GMT
From: Wolfgang Denk <wd@uebemc.siemens.de>
Subject: Re: Perl for Embedded Systems? Misc Qestions...
Message-Id: <6p73g5$mt$1@galaxy.mchh.siemens.de>
Keywords: Perl, Embedded Sytems, LynxOS
Sorry for f'up to my own posting:
>is there anybode using Perl in Embedded Systems? I've looked through
>the FAQ's and Web pages, but found no or only very few information...
There are two nother question I was unable to answer:
* Is there a way to configure (and compile, but this part is the easy
one) Perl in a Cross Development Environment?
* Is there a way to install modules from the CPAN in a Cross
Development Environment?
Thanks in advance,
Wolfgang Denk
--
Office: (+49)-89-722-27328, Fax -36703 Wolfgang.Denk@oen.siemens.de
Private: (+49)-89-95720-110, Fax -112 wd@denx.muc.de
Nail here --X-- for new monitor.
------------------------------
Date: 21 Jul 1998 08:16:09 GMT
From: hermann.flacke@t-online.de (Hermann Flacke)
Subject: Q:Newbie-Howto: Embedded WIN32-Perl in a DLL
Message-Id: <6p1ioa$6i9$1@news01.btx.dtag.de>
I would like to invoke the perl interpreter from a DLL and call a
module from my C++-Program. Is there any way to to this?
------------------------------
Date: Thu, 23 Jul 1998 13:36:57 +0200
From: Hakan Jonsson <hakjo733@student.liu.se>
Subject: References as strings
Message-Id: <35B72059.617F2C73@student.liu.se>
I am trying to store references as strings, and then later dereference
them. THis far, I have not succeded. Perhaps someone could give me an
advice.
For example, if I do like this:
$a = "string";
$ref_to_a = \$a;
$string_ref_to_a = "$ref_to_a";
$string_ref_to_a upon being printed looks something like
SCALAR(0x9f29c), but
it can not be dereferenced. Is there a way to convert the "stringed"
reference back into a hard reference, or some other way to get to the
data in that location without using the real reference variable?
gratefully
o
Hakan L O Jonsson
"To Iterate is Human, to Recurse is Divine"
------------------------------
Date: Thu, 23 Jul 1998 08:42:18 GMT
From: merzky@my-dejanews.com
Subject: Re: regexp vs. split
Message-Id: <6p6t19$1b8$1@nnrp1.dejanews.com>
In article <6p58im$4bm$1@nnrp1.dejanews.com>,
mboedicker@my-dejanews.com wrote:
> Does anyone see any reason why these two pieces of code wouldn't do the same
> thing?
>
> while(<SEARCH>) {
> s/\"//g;
> s/.*?\|//;
> @fields = split(/\|/);
> foreach $field (@fields) {
> ... etc
> --------------
> while(<SEARCH>) {
> s/\"//g;
> @fields = split(/\|/);
> $fields[0] = "";
> foreach $field (@fields) {
> ... etc
> --------------
>
> I have a file of the format blah|blah|blah|blah and basically I want @fields
> to be an array of all the fields except the first one. Right, now I am using
> example #2. The first example seems to strip out the first two fields.
> Thanks.
Hmmm, for me both versions work fine, and the 1st even better than the
2nd, since the leading field is really gone, and not just empty:
--------
#!/usr/bin/perl -w
use strict;
{
my ($teststring) = " 1 | 2 | 3 | 4 | 5 | 6 ";
my (@fields) = ();
my ($field) = "";
{
my ($test) = $teststring;
$test =~ s/\"//g;
$test =~ s/.*?\|//;
@fields = split(/\|/, $test);
foreach $field (@fields) {
print "++ $field\n";
}
print "---------------\n"
}
{
my ($test) = $teststring;
$test =~ s/\"//g;
@fields = split(/\|/, $test);
$fields[0] = "";
foreach $field (@fields) {
print "-- $field\n";
}
print "---------------\n"
}
}
-------------
gives:
am [merzky] /tmp : ./t.pl
++ 2
++ 3
++ 4
++ 5
++ 6
---------------
--
-- 2
-- 3
-- 4
-- 5
-- 6
---------------
Maybe, you do strip the first field somewhere else before??
Andre.
> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
>
--
Andre Merzky
pinocchio@earthling.net
http://pino.home.pages.de/
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: 23 Jul 1998 10:48:26 GMT
From: Matthew Flinchbaugh <matthew@nofear.hjsoft.com>
Subject: sendmail code
Message-Id: <6p74dq$j93$2@butterfly.hjsoft.com>
does anyone know what i can use in a code to make sendmail run the mail
bomber with a oerl script
------------------------------
Date: 23 Jul 1998 06:48:32 GMT
From: k y n n <NOSPAMkEynOn@panix.comNOSPAM>
Subject: Re: STUMPED!!! (perl trivia)
Message-Id: <6p6mc1$arb@news1.panix.com>
Now that someone kindly tossed a cluebrick my way, I feel the title of
this post should be "STUPID!!!" Good grief. Anyway, for my clueless
brethren, if any: it's $x =~ s/\000+$//.
In <6p6kjl$a9f@news1.panix.com> k y n n <NOSPAMkEynOn@panix.comNOSPAM> writes:
>I have a variable $x containing a pack()ed, nil-padded string (to be
>precise, it was produced via pack('a64', "foo"), but, in general, the
>unpadded length is unknown); I want to produce a variable $y
>containing the unpadded string. To my chagrin, I haven't managed to
>come up with anything better than:
>$y = join('', map chr, grep($_ > 0 , unpack 'c*', $x))
>Since I've "solved" the problem, however inelegantly, I guess this
>question reduces to one of perl trivia: how to do this more elegantly?
>I'm sure there's a simple, direct way of doing this, but hellifiknow
>what it is. Any ideas?
>K.
------------------------------
Date: Thu, 23 Jul 1998 11:01:49 GMT
From: drummj@mail.mmc.org (Jeffrey R. Drumm)
Subject: Re: The act of glueing one cat's nose to another's tail...
Message-Id: <35b717d1.1401875@news.mmc.org>
On 23 Jul 1998 00:07:17 GMT, gebis@albrecht.ecn.purdue.edu (Michael J Gebis)
wrote:
>cberry@cinenet.net (Craig Berry) writes:
>
>}Shaun Gilroy (shaung@onlinetech.net) wrote:
>}: Does anyone have a suggestion on how to copy and concatenate entire
>}: files in PERL without resorting to:
>}: exec "cat ...";
>
>}That's trivial to write in Perl.
>
>Just to bolster the Craig's claim, here's the complete source to cat
>written in perl:
>
>#!/usr/bin/perl -p
Not quite:
Syntax
cat [ -q ] [ -r ] [ -s ] [ -S ] [ -u ] [ -n [ -b ]
] [ -v [ -e ] [ -t ] ] [ - | File ... ]
;-)
--
Jeffrey R. Drumm, Systems Integration Specialist
Maine Medical Center - Medical Information Systems Group
drummj@mail.mmc.org
"Broken? Hell no! Uniquely implemented!" - me
------------------------------
Date: 23 Jul 1998 11:21:06 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: The act of glueing one cat's nose to another's tail...
Message-Id: <6p76b2$l7o$1@pegasus.csx.cam.ac.uk>
Michael J Gebis <gebis@albrecht.ecn.purdue.edu> wrote:
>Just to bolster the Craig's claim, here's the complete source to cat
>written in perl:
>
>#!/usr/bin/perl -p
That doesn't seem to support the cat -v option. :-)
Mike Guy
------------------------------
Date: Thu, 23 Jul 1998 00:50:02 -0700
From: "John" <jkramer@primenet.com>
Subject: Re: the low road
Message-Id: <6p6psr$51t$1@nnrp02.primenet.com>
First of all I would like to thank all of the fine people who posted replies
here and also those who send suggestions via e-mail. I must say I am a bit
overwhelmed. I started the day with a method of solving my problem that
worked and an idea of how it might have been done different. I now have no
less than seven different ways of accomplishing my goal. This is truly a
tribute to the flexibility of this language. You all have been most kind in
helping this aspiring perl wizard muddle through the nuts and bolts of the
language. It is true what Randal L. Schwartz said about the perl community
being a very helpful lot. I have still a long road to travel but I am
honored to be in such company.
As to the reason on my desire to replace the \n with a <BR> rather than just
add the <BR> it is as follows. The script that I was writing was built to
collect data from a form, funnel it into a specified number of strings, and
then write the strings to a data file. Another script would then read the
data file and assign strings to each line. So it was imperative that each
string only take up one line. Passing \n caused a given string to turn into
two or more lines, which botched the whole database.
I do realize that this would not be considered as strong code. It was,
however, the best that I could do at the time but I am striving to do better
and perhaps some day I too can help a struggling novice gain more insight
into the power of perl
Thanks again all.
John
------------------------------
Date: 23 Jul 1998 10:24:31 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: the low road
Message-Id: <6p730v$k02$1@pegasus.csx.cam.ac.uk>
Dean Pentcheff <dean@tbone.biol.sc.edu> wrote:
>
>For example (note: untested code follows):
>
> my(@input) = <INFILE>;
> $\ = "<br>";
> print grep(/relevant/, @input);
>
>However, a lot of folks tend to shy away from changing input and
>output separators unless really necessary. It can lead to enormous
>confusion for code maintainers, since it potentially leads to a kind
>of "spooky action at a distance" far removed from the point in the
>code where you change the separator.
There's good reason to steer clear of global variables like that
if you use them as in your example.
If you localise any setting of them to a small enough block, which
doesn't call any subroutines, there's no problem. So write the above
as
my(@input) = <INFILE>;
{ local $\ = "<br>";
print grep(/relevant/, @input);
}
and there's no danger of disturbing other code. (Well, apart from
signal handlers. But Perl signals aren't reliable anyway.)
Mike Guy
------------------------------
Date: Thu, 23 Jul 1998 09:54:59 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: Variable Interpolation
Message-Id: <35B6FA63.BF26D8C@nortel.co.uk>
Tad McClellan wrote:
>
> This is a popular quote from the 'perldiag' man page (second time today):
Have you noticed that ? I am quite amazed by the fact that you don't
hear from a certain subject for ages, and suddenly you get 2, 3 or 4
similar postings on one day. I find that weird...
--
____________________________________________________________
Frank Quednau
http://www.surrey.ac.uk/~me51fq
________________________________________________
------------------------------
Date: 23 Jul 1998 11:51:25 GMT
From: scott@softbase.com
Subject: Re: W32 Port
Message-Id: <35b723bd.0@news.new-era.net>
Bruce Davidson (news@allied.demon.co.uk) wrote:
> Using w32 port Pw32i316.exe on 386dx/Win95/PWS, is there a way to use
> open (PROC, "| sleep 1; rm -f $basepath/$mydir/$FORM{'myid'}.ext");
> I can't use unlink because of the $FORM call which I can't set as a
> predefined variable. (Pipe sleep is not really needed as is shown).
You're going to have to install a UNIX-compatible shell and
file utilities (like the Cygnus GNU port) to do this!
I don't understand wht the difference is between using unlink and
a shell here -- $FORM{} is $FORM{} whether you pass it to unlink or
the shell. It's a Perl variable substituted before the
call is made. What the call is doesn't matter. I'd rewrite the code
to use built-in Perl functions.
Scott
--
Look at Softbase Systems' client/server tools, www.softbase.com
Check out the Essential 97 package for Windows 95 www.skwc.com/essent
All my other cool web pages are available from that site too!
My demo tape, artwork, poetry, The Windows 95 Book FAQ, and more.
------------------------------
Date: Thu, 23 Jul 1998 17:22:57 +0800
From: Susan Cheung <sschng6@ie.cuhk.edu.hk>
Subject: what is the difference between "tie" & "dbmopen"?
Message-Id: <Pine.SOL.3.95.980723172200.3081A-100000@iesun31>
As title,
Thanks.
------------------------------
Date: 23 Jul 1998 09:25:56 +0100
From: Jim Brewer <jimbo@soundimages.co.uk>
Subject: Re: Win32 - SMTP
Message-Id: <ulnpl0y97.fsf@jimbosntserver.soundimages.co.uk>
Stefaan.Eeckels@ecc.lu (Stefaan A Eeckels) writes:
>
> In article <35AB9CEC.528F9E26@sirius.com>,
> Jim Bowlin <bowlin@sirius.com> writes:
> > photuris wrote:
> >>
> >> I am using ActiveState's Perl for Win32 ...
> >> what is the best way to have a script generate an
> >> email using SMTP?
> >>
> >> Thanks,
> >
> > I have heard some people report problems trying to
> > use SMTP with ActiveState as CGI. It seemed to be
> > that sockets were not getting closed properly.
> I have noticed that using Net::FTP with the standard
> distribution (5.004_2, Net version 1.0605) also
> results in file handle leakage - after a number of
> ftp open/close actions perl crashes. Using
> nthandleex shows 2 unnamed file handles remaining
> open after each iteration. The same test program
> under Linux runs for ages without any resource
> leaks. Associated with the file handles is an
> increase in memory usage of about 4k every 2-3
> iterations.
I had a problem with memory leakage as well. The move to 5.004_04
resolved this problem immediately. This was documented somewhere. Not
even sure if I was using 5.004_02 but, nonetheless, the move to
5.004_04 is advised by all and sundry.
ADVICE: Upgarade to 5.004_04 TODAY.
Jim Brewer
------------------------------
Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
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 3231
**************************************