[7588] in Perl-Users-Digest

Perl-Users Digest, Issue: 1214 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)Wed Oct 22 15:37:29 1997

Date: Wed, 22 Oct 97 12:00:32 -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, 22 Oct 1997 Volume: 8 Number: 1214
Today's topics:
Re: 2000 time problem (John Moreno)
[Q] STARTPERL define not working? thalerj_NOSPAM@wwa._NOSPAM.com
Re: [Q] STARTPERL define not working? (Mike Stok)
Re: [Reposted due to Enlow UCE cancel]: Perl and MS Exc (Faust Gertz)
Alpha sorting into an array <bfogarty@ford.com>
Browser uploads? (Dustin Masterson)
Re: caller(): any variables containing the call depth? (M.J.T. Guy)
Data driven code...? <pfortin@cisco.com>
help: perl and SMTP <dvinnola@wolonline.net>
HELP: strange problems with if () (Bruno Boettcher)
HELP: strange problems with if () ((null))
Re: Is there a Newsgroup for "Perl for NT and/or IIS"? <Jacqui.Caren@ig.co.uk>
Is there/will there be a decent way to do constants in (Gerben Wierda)
Re: Is there/will there be a decent way to do constants <seay@absyss.fr>
Re: Learning Perl... best way? (Faust Gertz)
Re: Looking for an authentication admin CGI named "Luci (Jeremy D. Zawodny)
Re: Move specified number of variables into one array?? <seay@absyss.fr>
naming variables after other variables ()
Newbie : Help installing Parse-Lex Module neal@homer.crane.navy.mil
Newbie Question : remove files named $files (Harold Kloosterhof)
Re: No output from a Perl script (Jeremy D. Zawodny)
Re: non-greedy regexps (Abigail)
Re: oraperl <Jacqui.Caren@ig.co.uk>
perl + Blat on NT problem matthewb@atomicvision.com
Perl and Windows95 question dilcher@cueva.com
Re: Perl Novice need info (Faust Gertz)
Re: Perl5.003 source ??? <tbag@interlog.com>
Precompiling PERL Scripts..... <rich@imedianet.com>
Random number in perl. <persson@tkj.se>
select($rout,undef,undef,undef) not working (always ret <jdturner@intrex.net>
Re: select($rout,undef,undef,undef) not working (always <seay@absyss.fr>
subscripting a function to get a single return value <tim@hcirisc.cs.binghamton.edu>
Re: Win32, del file? (Eric)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 22 Oct 1997 14:33:23 -0400
From: phenix@interpath.com (John Moreno)
Subject: Re: 2000 time problem
Message-Id: <19971022134303922390N@roxboro-169.interpath.net>
Doug Seay <seay@absyss.fr> wrote:
] John Moreno wrote:
] >
] > But when this does start to happen I hope that the people designing
] > this data type set a better X than either 1904 or 197(?) - one that
] > goes back a little farther for people doing historical work.
]
] This doesn't scale too far back, as the fundamental calendar has
] changed several times in the past few thousand years (not to mention
] that not everyone uses this calendar). Remember that not everyone
] adopted the Gregorian Calendar at the same time (this is why George
] Washington has two possible values for his birthday: the English
] adopted the Gregorian Calendar while Georgie was alive). You might
] have to pick a single place (Rome, Athens, Bejing, Jerusalem,
] whatever) and use it as _the_ calendar and treat all the others as
] variations of this one calendar. Working with this calendar
] differences is OK for us humans, but not obvious for computers.
I'm know what you are talking about, but it seems like it would be best
to simply pick a arbitrary date in the past (after all neither 1904 or
1970 have any special significance to the general populace) and then do
count off the seconds since this (probably mythical) time/event using
the Gregorian Calendar.
] I don't see any scheme which will work for all cases. I'd like to
] switch 1970 to 2000 (ouch, that'll hurt) and just use that as a
] baseline and allow negative values. It won't be any easier to use
] than the 1970 base of today, but it will be a whole lot easier to
] explain to people.
I think using a 64 bit number and a event several thousand years ago
would be good enough for most people - sure some historians or geologist
will still have problems, but it'd cover 99.99% of the cases. And this
way dates in things like genealogical records could use the date in the
same manner as other programs.
--
John Moreno
------------------------------
Date: 22 Oct 1997 11:40:43 -0500
From: thalerj_NOSPAM@wwa._NOSPAM.com
Subject: [Q] STARTPERL define not working?
Message-Id: <62laab$rp4@miso.wwa.com>
Since perl5.004_01 is not installed on my system, I downloaded and compiled
it myself in my directory. In my configuration process, I allowed STARTPERL
to be defined as the proper location. However, when I create a script with
that string on top, it doesn't actually execute perl. Everything is fine
if I run "perl script.pl" instead, though. Any idea why?
This is from my config.h file:
#define STARTPERL "#!/usr2/users/fs2/jayt/perl/bin/perl" /**/
This is script.pl (actual script is not indented):
#!/usr2/users/fs2/jayt/perl/bin/perl
print "Hello World\n";
foreach $i (@INC) {
print "$i\n";
}
I am attempting to execute the script by typing "script.pl" from ksh. It
runs it as a list of ksh commands (dies on the foreach line).
"perl script.pl" works fine though.
---
-Jay Thaler
Remove _NOSPAM from my address to email me, if you so desire.
------------------------------
Date: 22 Oct 1997 18:10:12 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: [Q] STARTPERL define not working?
Message-Id: <62lfi4$nbf@news-central.tiac.net>
In article <62laab$rp4@miso.wwa.com>, <thalerj_NOSPAM@wwa._NOSPAM.com> wrote:
>Since perl5.004_01 is not installed on my system, I downloaded and compiled
>it myself in my directory. In my configuration process, I allowed STARTPERL
>to be defined as the proper location. However, when I create a script with
>that string on top, it doesn't actually execute perl. Everything is fine
>if I run "perl script.pl" instead, though. Any idea why?
Try a shorter path, maybe using a symbolic link. perlrun says:
Because many operating systems silently chop off kernel
interpretation of the #! line after 32 characters, some
switches may be passed in on the command line, and some
may not; you could even get a "-" without its letter, if
you're not careful. You probably want to make sure that
all your switches fall either before or after that 32
character boundary. Most switches don't actually care if
they're processed redundantly, but getting a - instead of
a complete switch could cause Perl to try to execute
standard input instead of your script. And a partial -I
switch could also cause odd results.
amongst other things and you may be running afould of that limit.
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com | Pencom Systems Administration (work)
------------------------------
Date: Wed, 22 Oct 1997 18:44:17 GMT
From: faust@wwa.com (Faust Gertz)
Subject: Re: [Reposted due to Enlow UCE cancel]: Perl and MS Excel
Message-Id: <345c4917.2245608@news.wwa.com>
On 22 Oct 97 at 12:05, Suhail Warsi wrote:
> I can't find the OLE module at the CPAN sites(perhaps I'm not
> looking in the right place) - can you be more specific as to a
> location where I can find it or can you possibly attach teh module
> to an e-mail and send it to me,
If you search for 'ole' using
http://theory.uwinnipeg.ca/search/cpan-search.html you will find
libwin32-0.08.tar.gz, which contains Win32:OLE, under
/modules/by-module/Win32/ Make sure that OLE.pm isn't
already part of your Activeware perl distribution before trying to
install it.
Streben nach Wahrheit
Faust Gertz
Philosopher at Large
------------------------------
Date: Wed, 22 Oct 1997 14:42:45 -0400
From: Ben Fogarty <bfogarty@ford.com>
Subject: Alpha sorting into an array
Message-Id: <344E4925.2ABFF0C5@ford.com>
I have an interesting problem which should be a snap, but I can't seem
to find the right solution either in the Camel book, the FAQ's or the
man pages. It involves a situation in which I am reading a large number
of records into a perl script and sorting them into an array. There
should be around 100 to 200 "lines" in the array, and for each line, a
series of line "components" (or buckets for you old timers) that contain
a count of the number of times I have read a line in with the same sort
key, but a different date. The file will look something like:
ader 1 3 5 7 3 ...... > 52 numbers
bdwr 4 5 3 4 5 3 ... > 52 numbers
.
.
As I bring in a new line of information, (there may be as many as 1/2
million lines coming in), I want to parse out the information I need
from the new line, and build a sort key for this line, then sort the
existing array to see if the sort key represents a line already in the
array. If it does, I merge the new data into the old line. If the new
sort key is not found in the array, I put it in. Pretty simple, huh??
The problem I am having is I can't seem to find a method of sorting by
looping through the existing array lines and seeing if the new sort key
is already there. I have tried:
if ($key lt $array[0][$j]) { goto next check }
if ($key eq $array[0][$j]) { goto merge it }
if ($key eq $array[0][$j]) { goto add it }
but this does not fly. I read the book, and it deals with sorting
already built arrays. I don't want to do this since there are too
many duplications to build a massive array. I want to build the array
sorted as I go. I think it's possible, but I have not figured out the
details on how I can do it.
The question I ask of you is "Have you done this? Do you know how I can
do this? Is there life after death?" or any of the above. If you are
more clever than I (and I assume most of you are), could you please
suggest a solution to merging new
entries into an existing string type array?
I thank you very much for reading this drivel. I will thank you even
more if you can provide a suggestion to solve my
problem. Write soon.
Ben
------------------------------
Date: 22 Oct 1997 17:59:05 GMT
From: dmasterson@mainsgate.arc.nasa.gov (Dustin Masterson)
Subject: Browser uploads?
Message-Id: <dmasterson-2210971058570001@207.33.144.145>
I know that it is possible to upload from a web browser using the HTML forms
mulitpart/form-data encoding type. This method is however much less than
ideal for several reasons:
1) File sizes become much larger once they are encoded-very bad for ppl on
slow connections
2) The user is not able to see any kind of a status as to the completation
of the file transfer whether that be a status bar or even something as
crude as a dialog box and/or page informing the user that they are
experiencing normal delay
3) It can be difficult to tell what files have been uploaded and by who
not to mention any type of meta information that you might want a user to
provide with the file.
So what I'm looking for is a way to solve all of these problems by use of
either a Java Applet, and/or a perl script, that would be able to handle
the uploads preferably via ftp (though http would be OK too). But in
addition to uploading it would also need to pass other form data and a
pathname to where the file was uploaded along to another cgi so that that
info from the form could be logged into a database.
I'm not sure however what I should be using to creat this tool, since
server software will need to run on both a Mac and a Win32 system my
thought is a Java Applet since it could also add client side
functionality. But a perlscript would be a lot eaasier to write. And
javascript would be best but I don't think it can do the job.
To sum up my question is: Should I be using Java, perlscript, or
Javascript in order to make this thing work?
Any help would be much appreciated.
Dustin Masterson
dmasterson@mainsgate.arc.nasa.gov
------------------------------
Date: 22 Oct 1997 15:44:43 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: caller(): any variables containing the call depth?
Message-Id: <62l71b$iln$1@lyra.csx.cam.ac.uk>
In article <876941756.26733@dejanews.com>,
<gtuckerkellogg@genetics.com> wrote:
>
>BTW, I've recently taken to defining a function
>
>sub absolve {
> warn Carp::longmess @_ ;
>}
If you have a recent Perl (5.004_02 or later), see Carp::cluck.
Mike Guy
------------------------------
Date: Wed, 22 Oct 1997 13:53:06 -0400
From: Pierre Fortin <pfortin@cisco.com>
Subject: Data driven code...?
Message-Id: <344E3D82.2E9C0C07@cisco.com>
Hi,
I'm trying to write code to read lines from a file and invoke specific
subroutines based on the input data (i.e., $data = "foo", so invoke:
eval $data.'(@bar)'; which is really foo(@bar); ...) So far, so good;
but there are cases where the resulting call is to a non-existant
routine (at least until I get arround to writing one). I just need to
know that this is not a valid routine name (and might never be).
Is there a way to determine to "-w|use strict"'s satisfaction that a
routine exists:
- locally
- externally
- at all
- other?
Since this project may never terminate, this will be a fact of life for
my code.
Ideas?
Thanks,
Pierre
------------------------------
Date: 22 Oct 1997 16:48:22 GMT
From: "dan vinnola" <dvinnola@wolonline.net>
Subject: help: perl and SMTP
Message-Id: <01bcdf0a$e7c02e90$1e9b58ce@wol3>
I am trying to create a script that will read a file and build an email to
send to an SMTP host. Has anyone done that? I have had bad luck searching
the web on this one.
------------------------------
Date: 22 Oct 1997 20:51:35 +0200
From: uj89@rzstud1.rz.uni-karlsruhe.de (Bruno Boettcher)
Subject: HELP: strange problems with if ()
Message-Id: <62lhvn$kjr@rzstud1.rz.uni-karlsruhe.de>
Hello,
i am not really the professionnal perl programmer, so please don't
blame me if it is a stupid question....
here it goes, i have the following script:
#!/usr/bin/perl
$MKYBOOL = false;
while (<>)
{
if (/^text.*$/) {
$MKYBOOL = true;
}
if ( $MKYBOOL == true ) {
print $MKYBOOL;
print "\n";
}
if (/"]\)/) {
$MKYBOOL = false;
}
}
now i had supposed, that i would get as a result only a number of 'true'
relative to the number of matches....
so i was really surprised when getting the following output:
true
true
false
false
true
true
false
false
false
what did i overlook????
perlstats:
This is perl, version 5.003 with EMBED
Locally applied patches:
SUIDBUF - Buffer overflow fixes for suidperl security
built under linux at Apr 22 1997 10:14:54
+ two suidperl security patches
on a linux-alpha machine...
and same thing on my Ppro-linux box running version 5.004_01
so it really seems that i didn't understood something....
--
==============================================================
bboett@erm1.u-strasbg.fr
http://sneezy.u-strasbg.fr/~bboett
------------------------------
Date: 22 Oct 1997 18:52:55 GMT
From: bboett@erm1.u-strasbg.fr ((null))
Subject: HELP: strange problems with if ()
Message-Id: <62li27$ale@news.u-strasbg.fr>
Hello,
i am not really the professionnal perl programmer, so please don't
blame me if it is a stupid question....
here it goes, i have the following script:
#!/usr/bin/perl
$MKYBOOL = false;
while (<>)
{
if (/^text.*$/) {
$MKYBOOL = true;
}
if ( $MKYBOOL == true ) {
print $MKYBOOL;
print "\n";
}
if (/"]\)/) {
$MKYBOOL = false;
}
}
now i had supposed, that i would get as a result only a number of 'true'
relative to the number of matches....
so i was really surprised when getting the following output:
true
true
false
false
true
true
false
false
false
what did i overlook????
perlstats:
This is perl, version 5.003 with EMBED
Locally applied patches:
SUIDBUF - Buffer overflow fixes for suidperl security
built under linux at Apr 22 1997 10:14:54
+ two suidperl security patches
on a linux-alpha machine...
and same thing on my Ppro-linux box running version 5.004_01
so it really seems that i didn't understood something....
--
ciao
bboett at erm1 dot u-strasbg dot fr
==============================================================
bboett at erm1 dot u-strasbg dot fr
------------------------------
Date: Wed, 22 Oct 1997 18:50:29 GMT
From: Jacqui Caren <Jacqui.Caren@ig.co.uk>
Subject: Re: Is there a Newsgroup for "Perl for NT and/or IIS"?
Message-Id: <EIGv06.DAE@ig.co.uk>
In article <3438035C.6A80@icl.fi>,
Petri Backstrom <petri.backstrom@icl.fi> wrote:
>Peter Prymmer wrote:
>>
>> Cameron Dorey wrote:
>> > Windows (my last non-PC computer experience was Fortran on a VAX 780 in
>> I presume you meant a VAX 11-780: a fine machine for number crunching
>
>Allthough, if my memory serves me right, even if the docs
>said VAX-11/780, the front panel on the actual box didn't
>have the dash; i.e., it was VAX 11/780 (or maybe it was
>written in different ways during its lifetime ;-).
Not that I remember. I always saw a 11/78*'s (in the UK..).
I do remember running an app (as a newbie) on the console
and typing ^P to refresh a page - and getting a reboot.
Never ran that app on the console ever again... :-(
Jacqui
--
Jacqui Caren Email: Jacqui.Caren@ig.co.uk
Paul Ingram Group Fax: +44 1483 419 419
140A High Street Phone: +44 1483 424 424
Godalming GU7 1AB United Kingdom
------------------------------
Date: Wed, 22 Oct 1997 14:47:59 GMT
From: G.C.Th.Wierda@AWT.nl (Gerben Wierda)
Subject: Is there/will there be a decent way to do constants in perl?
Message-Id: <EIGJrz.K4K@AWT.NL>
As my use of *::something = \$whatever triggers bugs in perl 5.004_03 and as
the use constant pragma gets me into all kinds of trouble with strict subs,
differences between inside doublequoted strings and outside doublequoted
strings (and uglyness like "@{[&SOMECONST]}" if I only want to use it, I was
wondering if I have to give up to use constants in perl.
Larry? Why cannot perl get a constant reserved word in the syntax with the
expected effect?
---
Gerben Wierda,
Stafmedewerker Adviesraad voor het Wetenschaps- en Technologiebeleid.
Staff member Advisory Council for Science and Technology Policy
Javastraat 42, 2585 AP, Den Haag/The Hague, The Netherlands
Tel (+31) 70 3639922 Fax (+31) 70 3608992
http://www.AWT.nl/prive/wierda/
The fox knows many things, but the hedgehog knows one big thing.
"I believe in equality for everyone, except reporters and photographers."
- Mahatma Gandhi
------------------------------
Date: Wed, 22 Oct 1997 18:31:29 +0200
From: Doug Seay <seay@absyss.fr>
Subject: Re: Is there/will there be a decent way to do constants in perl?
Message-Id: <344E2A61.208046DE@absyss.fr>
Gerben Wierda wrote:
>
> As my use of *::something = \$whatever triggers bugs in perl 5.004_03 and as
> the use constant pragma gets me into all kinds of trouble with strict subs,
> differences between inside doublequoted strings and outside doublequoted
> strings (and uglyness like "@{[&SOMECONST]}" if I only want to use it, I was
> wondering if I have to give up to use constants in perl.
What are the problems that you have with
use constant NAME => "value";
with strict subs? All my perl scripts (even the "trivial" ones) use
"-w" and "use strict;". "strict subs" is a way of life for me and I've
never had a single problem with constant.pm. From the docs, there could
be a problem with the above if you also try
sub NAME { whatever }
because there will be a name space clash. My response is "don't do
that". There is no reason for a constant and a subroutine to have the
same name, so this is a non-problem IMnsHO.
I will agree that not being able to put a constant in a double quoted
string and have it expand could be a problem, but I don't consider that
to be a big deal. You can't make function calls from inside a double
quoted string either. Is this a show stopper for you? IIRC #defines in
C don't expand in double quotes either, but who am I to compare Perl to
C.
> Larry? Why cannot perl get a constant reserved word in the syntax with the
> expected effect?
constant.pm was contributed by Tom Phoenix, not Larry.
And what is your "expected effect"? Do you want to dynamically flag
variables as being 'constant' (read-only) at run time and lose the
optimization of constants? TomP's constants can cause blocks of code to
be constant folded away by the optimizer. I consider this to be useful
when I want things to run that tiny bit faster. Plus I'm enough of a
geek to think that automatic dead code removal is cool.
I'm not trying to be difficult. What I want is a clear definition of
what constants should do. With that maybe TomP can think about what
changes are possible.
- doug
------------------------------
Date: Wed, 22 Oct 1997 18:51:35 GMT
From: faust@wwa.com (Faust Gertz)
Subject: Re: Learning Perl... best way?
Message-Id: <345e4b25.2772119@news.wwa.com>
On Wed, 22 Oct 1997 08:48:12 +0100, "Lee Davies"
<lee.davies@microtest.co.uk> wrote:
>[A]ny recommendations on the best way to learn Perl? My background is
>in Unix programming using C, C++ and shell scripting so I'm fairly ok with
>the Perl scripts I have looked at so far, I just need some guidance...
Whatever you do, _don't_ look at the FAQ! :-)
http://language.perl.com/faq/
Streben nach Wahrheit
Faust Gertz
Philosopher at Large
BTW . . . If you also need to learn something about CGI, don't look at
Nick Kew's CGI FAQ (http://www.webthing.com/tutorials/cgifaq.html)
either.
------------------------------
Date: Wed, 22 Oct 1997 16:37:01 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: Looking for an authentication admin CGI named "Lucien"
Message-Id: <344e2b8b.444748434@igate.hst.moc.com>
[cc'd automagically to original author]
On Tue, 21 Oct 1997 13:30:30 -0500, spamnotmax_eper@hotmail.com (Steve
S) wrote:
>I'm looking for a cgi named "Lucien" that's used for administering the
>password file with auth-lib.pl (from Selena Sol). It was written by Leslie
>Orchard.
>
>It was at: http://www.industrynet.net/lorchard/cgi/ titled Talien's CGI
>Dreams, but the link is stale. Anyone know where to find it?
Hm... I'd start with Altavista, myself. It's faster than
comp.lang.perl.misc at locating software.
Jeremy
--
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio
http://www.marathon.com/
Unless explicitly stated, these are my opinions only--not those of my employer.
------------------------------
Date: Wed, 22 Oct 1997 17:00:40 +0200
From: Doug Seay <seay@absyss.fr>
To: Michael.Bach@kst.siemens.de
Subject: Re: Move specified number of variables into one array???
Message-Id: <344E1518.41535BF7@absyss.fr>
[posted and mailed]
Michael Bach wrote:
>
> Hi there...
>
> I have the following problem:
>
> 1) I get a certain number of arguments from a HTML-form via CGI.pm
> 2) I know the number of arguments
> 3) I do a loop to work on each of the arguments using the number of
> arguments
>
> ... this is where my problem comes in... I guess it's probably sheer
> stupidity:
>
> I would like to do something like this:
>
> while ( $bla != $numberOfArguments) {
> do something with @argument[$bla] ;
> $bla++;
> }
>
> The problem is that I get variables $argument1 - $argumentn and can't
> seem to figure out how to get all those single variable into one
> array... constructs like $argument$bla don't seem to work.
my @subarray = @array[0..$n-1];
This is called an array slice. It is mentioned in "perldata" and
"perlop". Maybe others too. You can use "perldoc" to read these
documents.
- doug
------------------------------
Date: 22 Oct 1997 16:40:13 GMT
From: mhempel@select.net ()
Subject: naming variables after other variables
Message-Id: <62la9d$jr0@newshub.atmnet.net>
Can you declare a variable with the name of another variable?
What would the syntax be?
--
____________________________________________________________________________
Matthew Hempel SelectNet Internet Services
Systems Administrator Carlsbad, California
(760) 438-9555
------------------------------
Date: Wed, 22 Oct 1997 10:11:49 -0600
From: neal@homer.crane.navy.mil
Subject: Newbie : Help installing Parse-Lex Module
Message-Id: <877532841.11664@dejanews.com>
I'm using the native Win32 port from CPAN(perl5.00402-bindist04-bc).
I'm trying to install the Parse-Lex module from CPAN.
After entering "perl makefile.pl" , I get the following:
E:\Perl\ParseLex-1.16>perl makefile.pl
MakeMaker (v5.42)
Checking if your kit is complete...
Warning: the following files are missing in your kit:
Makefile
Parse/Preprocess.pm
Please inform the author.
NAME => q[Parse::Lex]
PREREQ_PM => { }
VERSION_FROM => q[Parse/Lex.pm]
clean => { FILES=>q[err] }
dist => { COMPRESS=>q[gzip], SUFFIX=>q[gz] }
Using PERL=E:\PERL\BIN\perl
Writing Makefile for Parse::Lex
Why am I getting the "Warning" about files missing from the kit?
Thanks, Neal.
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: 22 Oct 1997 19:49:24 +0200
From: haroldkl@stack.nl (Harold Kloosterhof)
Subject: Newbie Question : remove files named $files
Message-Id: <62leb4$lfp@turtle.stack.nl>
Hi there,
I want to remove all files in directory /www/dir1/
which which have '.blah.' in the name (this 'blah' I don't know,
that's what the perl script finds out)
Now I've got this string $files="/www/dir1/*.blah.*"
I tried
unlink ($files)
and
unlink (<$files>)
but that didn't do the trick. The camel does not help
me any further ...
Who knows the answer ?
Thanks in advance
Harold
Harold Kloosterhof
haroldkl@stack.nl
------------------------------
Date: Wed, 22 Oct 1997 16:38:14 GMT
From: zawodny@hou.moc.com (Jeremy D. Zawodny)
Subject: Re: No output from a Perl script
Message-Id: <34502bd6.444823902@igate.hst.moc.com>
[cc'd automagically to original author]
On 22 Oct 1997 00:18:20 GMT, "Pedro Ascenso"
<pedro.ascenso@mail.telepac.pt> wrote:
>Hello, thanks for reading my message.
>
>I've wrote a Perl script that updates a database file. When I click on the
>submit button I want the script to be executed but I don't want to output
>anything to the browser.
>
>In my script I don't have any print statements, so I get the message
>"Document contains no data". How do I do to execute the script and stay on
>the same page.
To quote Tom Phoenix:
--
When you're having trouble with a CGI program in Perl, you should
first look at the please-don't-be-offended-by-the-name Idiot's Guide
to solving such problems. It's available on the perl.com web pages.
Hope this helps!
http://www.perl.com/perl/
http://www.perl.com/perl/faq/
http://www.perl.com/perl/faq/idiots-guide.html
--
Jeremy
--
Jeremy Zawodny
Internet Technology Group
Information Technology Services
Marathon Oil Company, Findlay Ohio
http://www.marathon.com/
Unless explicitly stated, these are my opinions only--not those of my employer.
------------------------------
Date: 22 Oct 1997 18:17:07 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: non-greedy regexps
Message-Id: <slrn64sgsv.qp.abigail@betelgeuse.wayne.fnx.com>
Randal Schwartz (merlyn@stonehenge.com) wrote on 1512 September 1993 in
<URL: news:8c3eluyjou.fsf@gadget.cscaper.com>:
++ >>>>> "Ashraf" == Ashraf Ahmed <ashraf@apollo3.com> writes:
++
++ Ashraf> Let's say I have a string like this,
++
++ Ashraf> "meeabmooabmuuabheheabyum"
++ Ashraf> -- -- -- --
++
++ Ashraf> and let's say that I want to find the (first) *shortest* sub-string
++ Ashraf> which starts with "ab" and ends with "ab". In this case, the returned
++ Ashraf> string should be
++
++ Ashraf> "abmooab"
++
++ Ahh... use the lazy quantifier:
++
++ print "meeabmooabmuuabheheabyum" =~ /(ab.*?ab)/;
++
++ Ashraf> The FAQ suggests using the perl5 non-greedy constructs, but I seem to
++ Ashraf> remember reading somewhere that one should be careful when using
++ Ashraf> these.
++
++ One should be careful in general. :-)
And rightly so. /ab.*?ab/ might not scale. As Ashraf indicated in
his post, what he really is looking is a way to say "match something
that does *not* contain ab". A sub regex of /ab.*?ab/ not necessarely
means "ab" something not ab "ab". It'll just match the shortest
leftmost substring that satisfies the _entire regex_.
It's a trap, and it's a nasty trap, because it usually does what you
expect it to do, and only fails when you don't expect it. I've made this
mistakes myself many times, and I see people making this mistake over
and over again.
What you really want is something like:
/ab(?:(?!ab).)*ab/
The . in (?:(?!ab).) can only match if it doesn't start a "ab".
For "meeabmooabmuuabheheabyum", /ab.*?abyum/ will match, and it
will match 'abmooabmuuabheheabyum'.
/ab(?:(?!ab).)*abyam/ on the other hand will match 'abheheabyum'.
/meeab.*?abyum/ will match the entire string, but
/meeab(?:(?!ab).)*abyam/ will not match at all.
Abigail
--
perl -wle 'print "Prime" if (1 x shift) =~ /^(?!(11+)\1+$)/'
------------------------------
Date: Wed, 22 Oct 1997 17:21:44 GMT
From: Jacqui Caren <Jacqui.Caren@ig.co.uk>
Subject: Re: oraperl
Message-Id: <EIGqw9.Cpw@ig.co.uk>
In article <343320D6.2172@Sun.COM>,
MARI J MORTELL <mari.mortell@Sun.COM> wrote:
>Hi,
>I am interested in oraperl.
>Can anyone point me to information on oraperl?
I am amazed that no one could point mari to the
DBI home page?
The center of the DBI world is
http://www.hermetica.com/technologia/DBI/
There are also dbi-users and dbi-dev mailing lists.
Note that
http://www.perl.com/
Is the center of the perl world follow the CPAN
links to find the relevant modules.
You need the DBI and DBD::Oracle packages.
make test and install DBI first.
Then make test and install the DBD::Oracle package.
This will install Oraperl.pm for you.
Jacqui
p.s. A distinction between oraperl and Oraperl
is made by those in the "know" :-)
oraperl is used when talking about the perl4 OCI addon.
Unless you are stuck with perl4 you DO NOT want to
use this interface. There are known bugs which will
never be fixed as this interface is no longer supported.
The very last version of oraperl had some v7 OCI calls
but still relied upon some deprecated v6 OCI calls.
with the advent of v8 I expect the oraperls out there
will die an ungracefull death with v8.
Oraperl is the oraperl emulation package sitting
over DBI and DBD::Oracle. Because we use it within
various products it receives extensive support and
upgrades.
p.p.s.
Paid support for perl/DBI/Oraperl can be
obtained from http://www.perl.co.uk/tpc/
--
Jacqui Caren Email: Jacqui.Caren@ig.co.uk
Paul Ingram Group Fax: +44 1483 419 419
140A High Street Phone: +44 1483 424 424
Godalming GU7 1AB United Kingdom
------------------------------
Date: Wed, 22 Oct 1997 11:03:54 -0600
From: matthewb@atomicvision.com
Subject: perl + Blat on NT problem
Message-Id: <877535077.14150@dejanews.com>
I am using Blat 1.5, NT 4, and Activeware Perl build 504.
+ Blat works from the command line.
+ a Perl script that calls Blat works from the command line.
+ the same perl script, executed through a web browser, does NOT
successfully call Blat.
I figure the problem is:
+ the system() command is somehow munged (so do I have mismatched versions
here?)
I am using this code to check the return value:
$rc = 0xffff & system($commandline);
if ( $rc == 0) {
print "system call has been executed. <P>\n";
} else {
print "system call failed. <P>\n";
}
This code indicates that Blat and nslookup fail; but it also indicates
that echo and dir succeed.
+ permissions are not set properly (where does Blat need to live, and with
what permissions?)
+ something else I'm not considering?
Thanks for the help.
Matthew Butterick
Atomic Vision
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: Wed, 22 Oct 1997 16:07:58 GMT
From: dilcher@cueva.com
Subject: Perl and Windows95 question
Message-Id: <344e241c.7211859@news.mindspring.com>
I have a script that I wrote in Perl that I want to give to a friend
who is running Windows 95.
In my Windows version of Perl, I note a couple of files:
perl.exe
perl300.dll
If my friend puts these two files in the same directory as the
perl script, will it run ok?
I guess I am asking this so as to spare my friend from having to
do a full blown perl installation on his machine in order to run
my one silly script.
Thanks for your help,
direct email responses greatly appreciated.
-jeff
------------------------------
Date: Wed, 22 Oct 1997 18:38:21 GMT
From: faust@wwa.com (Faust Gertz)
Subject: Re: Perl Novice need info
Message-Id: <345743ae.861004@news.wwa.com>
On 22 Oct 1997 10:57:06 GMT, coppari@cirfid.unibo.it (Maurizio
Coppari) wrote:
>I'm getting to be involved in a new project, in wich I need to develop portable
>CGI scripts in perl 5.
How very exciting. I'm serious.
>Is there a list of FAQ?
Look at the perl FAQ (http://language.perl.com/faq/) and Nick Kew's
CGI FAQ (http://www.webthing.com/tutorials/cgifaq.html).
>Can anyone suggest a good tutiorial book?
For a good _perl_ tutorial book, depending on your needs, try either
_Learning Perl_ or _Learning Perl on Win32 Systems_. Both books are
published by O'Reilly. Either way, look for a nice little book by
Eric Johnson entitled _Cross-Platform Perl_ published by M&T.
>What interpretars/compilers do you suggest to use under Unix and NT?
You will be able to find pointers to this information in the above
resources.
Streben nach Wahrheit
Faust Gertz
Philosopher at Large
------------------------------
Date: 22 Oct 1997 17:25:26 GMT
From: David Mayerlen <tbag@interlog.com>
Subject: Re: Perl5.003 source ???
Message-Id: <62lcu6$m2j$1@news.interlog.com>
Jeremy D. Zawodny <zawodny@hou.moc.com> wrote:
: On 21 Oct 1997 22:59:02 GMT, David Mayerlen <tbag@interlog.com> wrote:
: > I can't seem to find the source for perl5.003 anywhere. I need to recompile
: >my AIX perl executable. Obviously something has been deemed wrong with
: >perl5.003 because it can no longer be found in CSPAN but perl5.002 and
: >perl5.004 are available!
: Why not use 5.004 anyway? Is there something wrong with it?
There is probably nothing wrong with perl5.004, but a major web-ecommerce
application was put through weeks of testing on perl5.003 and from
Management's point of view, changing to perl5.004 will require re-testing
of the application. At this point, we just want to recompile perl5.003
with a better compiler and ensure optimal compile time options to squeeze
as much performance as we can out of it. The application is running a
little slower than was promised to the customer!
********************************************************************
* David Mayerlen +--------------------------+
* The Canadian Speculator | http://www.specstock.com |
* webmaster@specstock.com +--------------------------+
* 416.410.6679
********************************************************************
------------------------------
Date: 22 Oct 97 17:12:50 GMT
From: "Richard Secor" <rich@imedianet.com>
Subject: Precompiling PERL Scripts.....
Message-Id: <01bcdf0d$c0cc13a0$972e63cf@spawn.imedianet.com>
I know there's a way to do this so I'm asking,
how do you compile PERL scripts into executables so they run faster
(Yes, I do a lot of search engine and HTML re-writing scripts.)
Thanks in advance....
-=Rich=-
root@spaceball1.imedianet.com
------------------------------
Date: Wed, 22 Oct 1997 19:45:56 +0100
From: Eric Persson <persson@tkj.se>
Subject: Random number in perl.
Message-Id: <344E49E4.3EC@tkj.se>
I need to make a random nr in perl. Someone got a simple syntax for
this??
Please help me and reply via e-mail!
/Eric Persson
persson@tkj.se
------------------------------
Date: Wed, 22 Oct 1997 11:19:45 -0400
From: John Turner <jdturner@intrex.net>
Subject: select($rout,undef,undef,undef) not working (always returns)
Message-Id: <344E1991.8A1C8D19@intrex.net>
I am trying to write a script that tails a files and parses the
last message written to the file so I did this:
open the file
seek to the end
call select with the bit set for the fileno
and select returns immediately, does not block, and always has
the bit of the fileno set in the $rout vector.
This is under SCO Unixware 2.1 using Perl5.002, is this a bug others
have seen, or am I doing it wrong?
John
------------------------------
Date: Wed, 22 Oct 1997 17:34:14 +0200
From: Doug Seay <seay@absyss.fr>
Subject: Re: select($rout,undef,undef,undef) not working (always returns)
Message-Id: <344E1CF6.731662C1@absyss.fr>
John Turner wrote:
>
> I am trying to write a script that tails a files and parses the
> last message written to the file so I did this:
> open the file
> seek to the end
> call select with the bit set for the fileno
>
> and select returns immediately, does not block, and always has
> the bit of the fileno set in the $rout vector.
>
> This is under SCO Unixware 2.1 using Perl5.002, is this a bug others
> have seen, or am I doing it wrong?
The 4 arg version of select is very dependant upon the system's select()
call (same one you'd use in C). For most (all?) Unix systems, select()
never blocks on files, only on sockets and pipes. If you want to build
"tail -f" functionality, you'll have to poll every once in a while (tail
-f polls once a second IIRC). Sure it sucks, but that's life.
- doug
------------------------------
Date: 22 Oct 1997 11:24:54 -0400
From: Tim Gray <tim@hcirisc.cs.binghamton.edu>
Subject: subscripting a function to get a single return value
Message-Id: <t0hga9u8ft.fsf@hcirisc.cs.binghamton.edu>
Hi there,
I just tried something like this
$foo = ($dbh->sql("select foo from bar"))[0][0]
and it didn't work.
I am looking for the value of foo from the database and want to assign
it to $foo. The sql method returns an array of references to arrays.
Usually I would have to do something like this
@results = $dbh->sql("select foo from bar");
$foo = $results[0][0];
Is there any way to do it without using an intermediate array like
@results? Thanks.
Tim Gray
------------------------------
Date: Wed, 22 Oct 1997 15:51:45 GMT
From: eric@intiman.org_nospam (Eric)
Subject: Re: Win32, del file?
Message-Id: <344e20e0.2510592@intXnt>
Thanks for the help and advise! I'll try it all today.
On 21 Oct 1997 20:55:54 GMT, mike@stok.co.uk (Mike Stok) wrote:
>Have you tried unlink ? It is the name of the unix call which removes a
>link to a file (and if it's the last link the file is deleted.) The
>perlfunc man page says:
>
> unlink LIST
>
> unlink Deletes a list of files. Returns the number of
> files successfully deleted.
>
> $cnt = unlink 'a', 'b', 'c';
> unlink @goners;
> unlink <*.bak>;
>
> Note: unlink will not delete directories unless
> you are superuser and the -U flag is supplied to
> Perl. Even if these conditions are met, be warned
> that unlinking a directory can inflict damage on
> your filesystem. Use rmdir instead.
>
> If LIST is omitted, uses $_.
>
>Hope this helps,
>
>Mike
eric@intiman.org_nospam
Eric Kylstra
Computer Coordinator
Intiman Theatre
I have the nospam on the end of my email address for the obvious reason.
Remove it to email me directly.
------------------------------
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 1214
**************************************