[7564] in Perl-Users-Digest
Perl-Users Digest, Issue: 1190 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Oct 17 13:17:16 1997
Date: Fri, 17 Oct 97 10:00:26 -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 Fri, 17 Oct 1997 Volume: 8 Number: 1190
Today's topics:
Re: 2000 time problem <seay@absyss.fr>
Re: 2000 time problem (Mike Stok)
Re: 2000 time problem <seay@absyss.fr>
_Programming Perl_ new edition? (Damien C Leri)
Re: _Programming Perl_ new edition? <seay@absyss.fr>
Re: _Programming Perl_ new edition? <seay@absyss.fr>
Binary Distribution for Solaris 2.4 (Klaus Kettner)
Re: Binary Distribution for Solaris 2.4 <seay@absyss.fr>
Re: Hash question. Hierachies with pairs (Honza Pazdziora)
Help: redirected STDOUT lost (buffer overflow?) <romchr@ibm.net>
How to send email from perl for NT & IIS <myleslawrence@email.msn.com>
installhtml help sought lvirden@cas.org
Login name, password...NEWBIE HELP nothing@nowhere.com
Re: Need help on NT (Mike)
Re: NT IO/backticking <Jan.Krynicky@st.mff.cuni.cz>
nvi <aaron@soltec.net>
odd <rbush@up.net>
Re: odd <tycage@infi.net>
Re: Perl GDBM and delete records (M.J.T. Guy)
reading in input <webadmin@prestel.net>
Re: regular expression extensions <jefpin@bergen.org>
selecting files into array ()
Re: selecting files into array (Jeffrey R. Drumm)
Re: Socket problem in Perl!!!!!!!!!!! <seay@absyss.fr>
Re: Some strange Perl things? (Bob Wilkinson)
Re: Something like an "IN" test (Jim Esten)
Re: statics or const in perl ? (Andrew M. Langmead)
Re: String manipulation in Perl (Andrew M. Langmead)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 17 Oct 1997 15:19:26 +0200
From: Doug Seay <seay@absyss.fr>
Subject: Re: 2000 time problem
Message-Id: <344765DE.598C3852@absyss.fr>
Toutatis wrote:
>
> In article <627c9d$e3e$1@en1.engelschall.com>, sb@en.muc.de wrote:
>
> > Petri Backstrom <petri.backstrom@icl.fi> wrote:
> >
> > > Now, if I'd venture a guess, you will not be using Windows 95
> > > or the current release of Perl in 2038 (less in 2050), and I'm
> > > sure that long before 2038 you'll have a computer where this
> > > won't be a problem (in the Perl current then or anything else).
> >
> > That's exactly what the argument was back in the fifties or so when
> > the assembler and COBOL code was created that is going to break in
> > 2000...
>
> This argument,
>
> *PLUS* the consideration that computer memory and address space was scarce
> and *very* expensive. The choice was an easy one. The millennium bug didn't
> COST, but SAVED companies a lot of money.
Perhaps, but the fundamental problem is when 2 digit years were spec'd
that way. That is a language constraint. With Perl (ney, with all of
Unix), it is an implementation detail. Details can easily be changed
later, but specifications have a habit of being carved in stone.
- doug
------------------------------
Date: 17 Oct 1997 15:02:55 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: 2000 time problem
Message-Id: <627umv$amo@news-central.tiac.net>
In article <344765DE.598C3852@absyss.fr>, Doug Seay <seay@absyss.fr> wrote:
>Perhaps, but the fundamental problem is when 2 digit years were spec'd
>that way. That is a language constraint. With Perl (ney, with all of
>Unix), it is an implementation detail. Details can easily be changed
>later, but specifications have a habit of being carved in stone.
So the lack of specs for most of the stuff I am asked to do should be
considered as foresight by managers ;-)
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: Fri, 17 Oct 1997 17:28:56 +0200
From: Doug Seay <seay@absyss.fr>
To: Mike Stok <mike@stok.co.uk>
Subject: Re: 2000 time problem
Message-Id: <34478438.32E2EB33@absyss.fr>
Mike Stok wrote:
>
> In article <344765DE.598C3852@absyss.fr>, Doug Seay <seay@absyss.fr> wrote:
>
> >Perhaps, but the fundamental problem is when 2 digit years were spec'd
> >that way. That is a language constraint. With Perl (ney, with all of
> >Unix), it is an implementation detail. Details can easily be changed
> >later, but specifications have a habit of being carved in stone.
>
> So the lack of specs for most of the stuff I am asked to do should be
> considered as foresight by managers ;-)
Only if you do a good job.
- doug
------------------------------
Date: 17 Oct 1997 15:10:56 GMT
From: damien@red.seas.upenn.edu (Damien C Leri)
Subject: _Programming Perl_ new edition?
Message-Id: <627v60$b1r$1@netnews.upenn.edu>
i want to buy the acclaimed book _Programming Perl_ but notice that
the latest edition is almost a year old. i wonder if there will be a
new edition soon, a new version of perl, or if it won't matter much.
--
barn's burnt down--
now
i can see the moon.
-Masahide
http://homepage.seas.upenn.edu/~damien/
------------------------------
Date: Fri, 17 Oct 1997 18:15:54 +0200
From: Doug Seay <seay@absyss.fr>
To: Damien C Leri <damien@red.seas.upenn.edu>
Subject: Re: _Programming Perl_ new edition?
Message-Id: <34478F3A.A02B42C@absyss.fr>
[posted and mailed]
Damien C Leri wrote:
>
> i want to buy the acclaimed book _Programming Perl_ but notice that
> the latest edition is almost a year old. i wonder if there will be a
> new edition soon, a new version of perl, or if it won't matter much.
I doubt if they'll bother redoing it for Perl5. Maybe after the
compiler and threads are stable (5.5?) they'll think about it, but
according to Randal it is a bunch of work. I think he compared it to
"herding cats".
- doug
------------------------------
Date: Fri, 17 Oct 1997 18:24:29 +0200
From: Doug Seay <seay@absyss.fr>
Subject: Re: _Programming Perl_ new edition?
Message-Id: <3447913D.E1FEECC@absyss.fr>
Doug Seay wrote:
>
> Damien C Leri wrote:
> >
> > i want to buy the acclaimed book _Programming Perl_ but notice that
> > the latest edition is almost a year old. i wonder if there will be a
> > new edition soon, a new version of perl, or if it won't matter much.
>
> I doubt if they'll bother redoing it for Perl5.
I ment to say for another release of Perl5. ie 5.x.
- doug
------------------------------
Date: Fri, 17 Oct 1997 15:19:10 GMT
From: Klaus.Kettner@p2.fth3.siemens.net (Klaus Kettner)
Subject: Binary Distribution for Solaris 2.4
Message-Id: <3447817f.20721335@gate>
Hi,
i am searching a binary-distribution of Perl 5.00X for our Sun running
Solaris 2.4 . This is a rather old version of Solaris, but for some reasons
it is not possible for us to upgrade to 2.5 .
Can somebody help?
--
-kk-
mail: kk@sesom.de (private)
mail: kettner@usa.net (work)
web : www.n-online.de/~sesom
------------------------------
Date: Fri, 17 Oct 1997 18:21:06 +0200
From: Doug Seay <seay@absyss.fr>
To: Klaus Kettner <Klaus.Kettner@p2.fth3.siemens.net>
Subject: Re: Binary Distribution for Solaris 2.4
Message-Id: <34479072.8F39BD1@absyss.fr>
[posted and mailed]
Klaus Kettner wrote:
>
> Hi,
>
> i am searching a binary-distribution of Perl 5.00X for our Sun running
> Solaris 2.4 . This is a rather old version of Solaris, but for some reasons
> it is not possible for us to upgrade to 2.5 .
Not personally, no. But I would not recommend a binary version if you
can rebuild it locally. Perl likes to look around for things and record
the path. It also plays games depending upon NFS and/or AFS. Binary
copies can work, but it seems less optimal.
- doug
------------------------------
Date: Fri, 17 Oct 1997 15:14:55 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: Hash question. Hierachies with pairs
Message-Id: <adelton.877101295@aisa.fi.muni.cz>
Anas Nashif <nashif@rz.uni-mannheim.de> writes:
[...]
> and you want to get this output:
>
> 1,0
> 5,1
> 6,1
> 8,6
> 9,8
> 2,0
> 7,2
> 3,0
> 4,0
> 10,4
Not nice, but working solution:
#!/usr/bin/perl -w
use strict;
use vars qw( @data );
@data = ();
while (<>)
{
my ($num, $next) = /(\d+),(\d+)/;
$data[$num] = $next;
}
recurse(0, 1);
sub recurse
{
my ($prev, $indent) = @_;
my $i = $prev;
while ($i < scalar(@data))
{
if (defined $data[$i] and $data[$i] == $prev)
{
print "\t" x $indent, "$i,$data[$i]\n";
recurse($i, $indent + 1);
}
$i++;
}
}
__END__
Hope this helps.
--
------------------------------------------------------------------------
Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
I can take or leave it if I please
------------------------------------------------------------------------
------------------------------
Date: Fri, 17 Oct 1997 12:38:11 -0700
From: Chris Romano <romchr@ibm.net>
Subject: Help: redirected STDOUT lost (buffer overflow?)
Message-Id: <3447BEA2.5FFF3CB9@ibm.net>
Hi...
I'm trying to redirect the output from a "tar -cvf" command to a file:
I'm trying this on an AIX v3.2.5 and v4.1.4 system:
open(STDOUT,">/filename");
select(STDOUT);$|=1; # turn off bufferring (i think :-))
system ("tar -cvf ./home ./usr ./apps");
close(STDOUT);
...unfortunately, I only get the last half of the tar output in my file.
It seems as though a buffer fills up and gets overwritten, and the first
half
of the output disappears.
Does anyone have any ideas?
Thanks,
Chris Romano
c.romano@netaxis.qc.ca
------------------------------
Date: Thu, 16 Oct 1997 20:45:20 -0700
From: "Myles Lawrence" <myleslawrence@email.msn.com>
Subject: How to send email from perl for NT & IIS
Message-Id: <#MPZx5q28GA.241@upnetnews03>
I have a perl based bug tracking system running on NT40, IIS and Roth's
Win32::ODBC module to SQL Server. I'd like to send an email to the person
assigned the bug. Does anyone know how to to this???
Myles Lawrence
myleslawrence@msn.com mylesl@zeno.com
------------------------------
Date: 17 Oct 1997 15:06:46 GMT
From: lvirden@cas.org
Subject: installhtml help sought
Message-Id: <627uu6$nvq$1@srv38s4u.cas.org>
Has anyone out there experimented with using installhtml to go thru their
installed Perl lib structure and generate _all_ the HTML pages possible?
Using installhtml as documented in the perl5.*/INSTALL document generates,
from the source tree, a series of HTML documents for the CORE. However,
add on packages do not get covered.
What I would like to find is some way to use installhtml, pod2html, or
some other perl script that would walk thru the installation directory,
find pod doc, and build a tree that parallels the source tree, along with
a search engine that would allow me to search the HTML and show me hits.
If anyone else is thinking about this type of thing, or has worked something
out, please let me know.
--
Larry W. Virden INET: lvirden@cas.org
<URL:http://www.teraform.com/%7Elvirden/> <*> O- "We are all Kosh."
Unless explicitly stated to the contrary, nothing in this posting should
be construed as representing my employer's opinions.
------------------------------
Date: Fri, 17 Oct 1997 16:13:42 GMT
From: nothing@nowhere.com
Subject: Login name, password...NEWBIE HELP
Message-Id: <6282uj$nlg$1@news.gate.net>
when I pull up my script from the command line in dos:
ftp -s:filename.pl ftp.server.com
in my code, filename.pl, where do I tell it the 'user name' and' password'
so that the server will recognize it?
I'm connecting alright but then the server doesn't know where to look for the
'username' and 'password'
gljoe101@aol.com
------------------------------
Date: Fri, 17 Oct 1997 13:20:03 GMT
From: dont@spam.com (Mike)
Subject: Re: Need help on NT
Message-Id: <344765e3.74300470@news.accesscom.net>
Visit http://www.4images.com/ntperl
You may find the help you need there.
On Fri, 17 Oct 1997 12:35:38 +0800, dolven@fairhost.com (Dolven Chan)
mumbled these words:
|Dear fellows,
| I have tried to install Perl32 to run my scripts on my NT4.0 server. I
|used IIS3.0 as the WWW. Would anyone please tell me how to make the
|scripts work?
|
|1. Installed Perl Win32 on my DOS path.
|2. Autoinstall the PerlIS on IIS (add .pl ext.)
|3. I use regedt32 edit the
| HK_LOCAL_MACHINE\SYSTEM\CURRENTCONTROLSET\SERVICES\W3SVC\PARAMETER\SCRIPT_MAP
| I ADD [.CGI] VALUE TO REG_SZ WITH STRING TO THE FULL PATH OF MY PERL.EXE
| [C:\PERL\BIN\PERL.EXE %1 %*]
|4. RESTART
|
|I have checked my directory permissions and allow IUSER to use.
|Did I do any thing wrong? Please help..
|
|Thank You very much
----------------------------------------------
Spambot food:
president@whitehouse.gov
abuse@aol.com
abuse@att.net
abuse@uu.net
------------------------------
Date: Fri, 17 Oct 1997 16:06:07 -0700
From: Jan Krynicky <Jan.Krynicky@st.mff.cuni.cz>
To: David Ferguson <daf@altagroup.com>
Subject: Re: NT IO/backticking
Message-Id: <3447EF5F.D06@st.mff.cuni.cz>
David Ferguson wrote:
>
> I have installed the latest perl release (5.003_07) from the
> ActiveWare site and installed it on my NT running 4.0. I am
> trying to port some scripts from UNIX and am running into
> problems with the backticking. In short, I seem to lose output
> when invoked more than one level deep. One script that captures
> the backtick output of a system command will properly print that
> output. However, a second script, invoking the first within a
> set of backticks, does not receive any data. Could anyone give
> me any pointers for likely environment errors or just simple
> newbie-mistakes that might cause such a situation? Please don't
> tell me that I can't do it. Here is a set of scripts that are
> about as basic as I could get that reflect the problem.
>
> Test Scripts:
> c.pl:
> print "arf\n";
>
> b.pl:
> chop($bar = `c.pl`;
> print "bar is :$bar\n";
> chop($who = `id -u -n`);
> print "who is :$who\n";
>
> Invoking c.pl produces the following output:
> dir> c.pl
> arf
>
> dir>
>
> Invokiing b.pl produces the following output:
> dir> b.pl
> bar is :
> who is :GLOBAL\daf
>
> dir>
>
> Any clues as to what I'm doing wrong or where I should go look?
> Thanks for any help you can give.
>
> -David Ferguson
You have to use
$var = `perl.exe script.pl`;
Microsloths were not able to make IO redirection work since
MS DOS. Though they got it slightly better in WinNT recently.
Try
c:\>test.bat > result.txt
where
####test.bat
echo Hello, world.
####end-of-file
in DOS/Win95.
The file result.txt will be created, but it will stay empty.
The output of test.bat gets lost somewhere.
In WinNT you're able to redirect the output of .bat at last,
but .pl or anything else is dead.
I hope they will be able to fix it sometime aroud 2020 :-]
HTH, Jenda
------------------------------
Date: 17 Oct 1997 15:29:08 GMT
From: "Aaron" <aaron@soltec.net>
Subject: nvi
Message-Id: <01bcdb11$6bc79460$b5910a9f@aurora.cna.com>
Hi
I heard about a piece of software called NVI. So, I downloaded it and
installed it. The thing is, I have absolutely no documentation for it.
I've heard that it is a great help for people who like to PERL in VI.
Anyone have any information.
------------------------------
Date: Fri, 17 Oct 1997 10:41:10 -0400
From: "Raymond K. Bush" <rbush@up.net>
Subject: odd
Message-Id: <34477906.5C28@up.net>
I wipped this off on the command line this morning and am not sure why i
would get the message i see below. Any ideas what's going on and how to
fix it?
grep from maillog|cut -d"<" -f2|cut -d">" -f1|sort -u|cut -d"@"
-f2-|sort -u|grep -v " "|perl -nwe 'chomp; open(FD,"spamdom.test;while
(defined($spammer=<FD>)){$spamlist="$spamlist $spammer";}close(<FD>); if
($_ =~ $spamlist){print "$_\n";}'|more
Use of uninitialized value at -e line 1, <FD> chunk 1.
/ 1-500-fingers.com
1daystar.1daystar.com
1daystar.com
1mallonline.com
1stbiz.com
1stkidsclub.com
1stservices.com
1stworl/: regexp too big at -e line 1, <FD> chunk 1504.
--Ray
.70~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~07.
--- please include indication of past correspondence---
--- in order to receive a faster response ---
------------------------------
Date: Fri, 17 Oct 1997 11:13:56 -0400
From: Ty Cage Warren <tycage@infi.net>
Subject: Re: odd
Message-Id: <344780B4.45B4EF82@infi.net>
Raymond K. Bush wrote:
>
> I wipped this off on the command line this morning and am not sure why i
> would get the message i see below. Any ideas what's going on and how to
> fix it?
>
> grep from maillog|cut -d"<" -f2|cut -d">" -f1|sort -u|cut -d"@"
> -f2-|sort -u|grep -v " "|perl -nwe 'chomp; open(FD,"spamdom.test;while
> (defined($spammer=<FD>)){$spamlist="$spamlist $spammer";}close(<FD>); if
> ($_ =~ $spamlist){print "$_\n";}'|more
>
> Use of uninitialized value at -e line 1, <FD> chunk 1.
> / 1-500-fingers.com
> 1daystar.1daystar.com
> 1daystar.com
> 1mallonline.com
> 1stbiz.com
> 1stkidsclub.com
> 1stservices.com
> 1stworl/: regexp too big at -e line 1, <FD> chunk 1504.
>
Here is the script formated for readablilty as if it were in a file
(I've added line
numbers).
01: #!/usr/local/bin/perl -nw
02: chomp;
03: open(FD,"spamdom.test");
04: while(defined($spammer=<FD>)) {
05: $spamlist.="$spamlist $spammer";
06: }
07: close(<FD>);
08: if ($_ =~ $spamlist) {
09: print "$_\n";
10: }
I corrected a typo on line 03.
I added the .= on line 05 since I think that is what you meant.
It looks like you want to see if $_ is in $spamlist, which is a scalar
containing
the file spamdom.test.
Line 08 is causing your error. You are confusing how the =~ operator
works
and leaving out a bit of syntax as well. That line needs to read.
new 08: if ($spamlist =~ /$_/) {
to do what you want.
What your line is doing is checking to see if $_ contains $spamlist in
it. $spamlist appears to be very large.
You also didn't use // which is legal, put I think it looks bad. =)
I think you also take a performance hit for it, if I remember correctly.
Can some one back me up or shoot me down on that?
Check out the perlop manpage for more information.
Hope this helps,
Ty
+---+
Ty Cage Warren tycage@infi.net
Systems Engineer InfiNet
Homepage: http://tazer.engrs.infi.net/~tycage
PGP Public Key: http://tazer.engrs.infi.net/~tycage/pgpkey.html
PGP Fingerprint: FF C1 28 CA 80 B5 31 78 B1 24 2E 8C AB DA FB D2
------------->Never invoke anything bigger than your head.<-------------
------------------------------
Date: 17 Oct 1997 16:45:44 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Perl GDBM and delete records
Message-Id: <6284no$aan$1@lyra.csx.cam.ac.uk>
In article <876922507.3728@dejanews.com>, <rick@www.bpa.nl> wrote:
>Apparently deleting records from a GDBM hash within an each loop
>does not work. It works for the FIRST record, but after deleting
>that first record the each-loop exits. For a regular hash this does
>work fine (deleting entries from a hash is explicitly permitted,
>adding entries is not). Anyone a solution with GDBM?
No it doesn't work for ordinary hashes. You just happened to get
away with it, or didn't notice the error or something.
>From perldoc -f each:
=item each HASH
When called in a list context, returns a 2-element array consisting of the
key and value for the next element of a hash, so that you can iterate over
it. When called in a scalar context, returns the key for only the next
element in the hash. (Note: Keys may be "0" or "", which are logically
false; you may wish to avoid constructs like C<while ($k = each %foo) {}>
for this reason.)
Entries are returned in an apparently random order. When the hash is
entirely read, a null array is returned in list context (which when
assigned produces a FALSE (0) value), and C<undef> is returned in a
scalar context. The next call to each() after that will start iterating
again. There is a single iterator for each hash, shared by all each(),
keys(), and values() function calls in the program; it can be reset by
reading all the elements from the hash, or by evaluating C<keys HASH> or
C<values HASH>. If you add or delete elements of a hash while you're
iterating over it, you may get entries skipped or duplicated, so don't.
Note particularly that last sentence.
Mike Guy
------------------------------
Date: Fri, 17 Oct 1997 15:51:47 +0100
From: webadmin <webadmin@prestel.net>
Subject: reading in input
Message-Id: <34477B83.F59145F@prestel.net>
Hi
I have a perl script which calles another perl script. Now I want the
first one to parse values to the second one
`test.pl value1 value2`
the values should be sent to test.pl which can mainpulate them.
BUT I cant seemt o get the second script test.pl to actually read in the
data and display it. I can get it to work fine if I run the rpogram and
enter in the details from the keyboard, but not sending via the program
Iqbal
------------------------------
Date: Fri, 17 Oct 1997 09:58:42 -0400
From: TechMaster Pinyan <jefpin@bergen.org>
To: Shrikant Vijay Ranade <svr5@cac.psu.edu>
Subject: Re: regular expression extensions
Message-Id: <Pine.SGI.3.95.971017095109.21708A-100000@vangogh.bergen.org>
>i get the following error message.
>/&((?!vendor)|(?!Vendor)|(?!delivery))/: ?+* follows nothing in regexp
Try:
/&(?![vV]endor|delivery)/
I believe that works.
If I'm wrong, please correct me.
----------------
| "To be a rock, and not to roll."
| - Led Zeppelin
----------------
Jeff Pinyan | http://users.bergen.org/~jefpin | jefpin@bergen.org
webXS - the new eZine for WebProgrammers! TechMaster@bergen.org
Visit us @ http://users.bergen.org/~jefpin/webXS
** I can be found on #perl on irc.ais.net as jpinyan **
- geek code -
GCS/IT d- s>+: a--- C+>++ UAIS+>$ P+++$>++++ L E--->---- W++$
N++ !o K--? w>+ !O M>- V-- PS PE+ !Y !PGP t+ !5 X+ R tv+ b>+
DI+++ D+>++ G>++ e- h- r y?
------------------------------
Date: 17 Oct 1997 12:36:28 GMT
From: mathias@linux.ek79.uni-koeln.de ()
Subject: selecting files into array
Message-Id: <627m4c$gpd@news.rrz.Uni-Koeln.DE>
Hi,
I am looking for a way to get filenames selected
by a command line expression into an array, i.e
> TheScript m??rep.*
TheScript:
#!/usr/bin/perl
$SelectionString = @ARGV;
m??rep.* -> @Files
...
@Files[1] = m95rep.in;
@Files[2] = m95rep.out;
@Files[3] = m96rep.in;
...
Thank you for your emailed tip.
Regards,
Mathias
------------------------------
Date: Fri, 17 Oct 1997 15:08:18 GMT
From: drummj@mail.mmc.org (Jeffrey R. Drumm)
Subject: Re: selecting files into array
Message-Id: <34477e29.90284041@news.mmc.org>
On 17 Oct 1997 12:36:28 GMT, mathias@linux.ek79.uni-koeln.de () wrote:
>Hi,
>
>I am looking for a way to get filenames selected
>by a command line expression into an array, i.e
>
>
> > TheScript m??rep.*
Aaaah, but they're already in an array, and you didn't have to do doodly-squat!
see the @ARGV variable in perlvar man page . . .
You will, of course, need to do some special processing if you intend to pass
flags/options as well as filenames to the script.
>
>Mathias
--
Jeffrey R. Drumm, Systems Integration Specialist
Maine Medical Center - Medical Information Systems Group
420 Cumberland Ave, Portland, Maine 04101
Voice: 207-871-2150 Fax: 207-871-6501 Email: drummj@mail.mmc.org
------------------------------
Date: Fri, 17 Oct 1997 14:48:38 +0200
From: Doug Seay <seay@absyss.fr>
To: David Wu <savy@public3.bta.net.cn>
Subject: Re: Socket problem in Perl!!!!!!!!!!!
Message-Id: <34475EA6.3E80BA62@absyss.fr>
David Wu wrote:
>
> I'm a newbie of Socket program by Perl. I want to develop the socket
> application by Perl. For example: Send a mail to the SMTP server. I use
> Windows95&WindowsNT 4.0, Perl 5.01. How can Perl do this? Thanks for any
> help you can give me. The source code is preferred.
Upgrade to 5.004 so you get the IO::Socket.pm module then incant
perldoc IO::Socket
and voila, you have examples of how to make network connections. But
you could also go to CPAN, because I think that there are modules that
do just this sort of thing.
- doug
PS - this had better not be for some UBE blaster
------------------------------
Date: Fri, 17 Oct 1997 13:43:44 +0100
From: b.wilkinson@pindar.com (Bob Wilkinson)
Subject: Re: Some strange Perl things?
Message-Id: <b.wilkinson-1710971343440001@ip57-york.pindar.co.uk>
In article <34453D1F.82085745@mail.hsclib.sunysb.edu>, Jim Xikis
<jxikis@mail.hsclib.sunysb.edu> wrote:
> This is a multi-part message in MIME format.
> --------------8B0A06210E5B1022190F18D0
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: 7bit
>
> I'm having a problem understanding why the following code does not work
> the way one would expect. I'm possitive there is a better way to do
> this but I originally wrote it this way and some weird things happened.
> The script is supposed to open a file, make some replacements to the
> text, write to a temp file, then open the temp file and make some
> replacements to that text etc.
>
> Here's what happens:
>
> If I use anything other than "F" or "G" for a file handle, nothing is
> written to any of the temp files but "temp1".
>
> Then, there are a bunch of lines in the code that I threw in that are as
> follows:
>
> if (eof G){
> close <G>; }
<DELETIA>
No, close takes a file handle as an argument. Use "close G" instead.
Bob
--
.sig file on holiday
------------------------------
Date: 17 Oct 1997 11:10:08 -0500
From: jesten@earth.execpc.com (Jim Esten)
Subject: Re: Something like an "IN" test
Message-Id: <6282l0$85p$1@earth.execpc.com>
: In article <EI5o84.MLy@utcc.utoronto.ca>,
: Gord Russell <gord@oracle.utoronto.ca> wrote:
: >I'm new to perl and I'd like to do at test something like:
: >
: >if ($var IN ("A", "B", "C") { }
: >
: >but perl doesn't seem to have anything like an IN test. I've
: >been trying to do the same sort of thing with pattern matching,
: >such as
: >
How about having the test chars in an array and using something on
the order of:
&is_it_in_there(@chars); where the sub looks something like:
sub is_it_in_there {
my(@testarray) = @_;
foreach(@testarray) {
return(1) if (/whatever you want to match../)
}
}
... a bit limiting, but should give you the idea...
Jim
--
Jim Esten
WebDynamic
jesten@wdynamic.com http://wdynamic.com
------------------------------
Date: Fri, 17 Oct 1997 14:38:00 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: statics or const in perl ?
Message-Id: <EI79zD.n2u@world.std.com>
Tom Phoenix <rootbeer@teleport.com> writes:
>On Thu, 16 Oct 1997, Andrew M. Langmead wrote:
>> Unfortunately, because the problems with lists, they don't quite fit
>> the original posters criteria.
>>
>> use constant LIST => qw(a b c de f g);
>> for(@_) {
>> tr/a-mn-zA-MN-Z/n-za-mN-ZA-M/;
>> }
>>
>> Silently ignores attempts to change the members of LIST and:
>Sure, 'cause you never touched them! :-)
OK, cut and paste error,substitute "for(LIST)", and it works just like
the one in the subroutine. Unfortunately, it won't cause the hoped for
result:
Modification of a read-only value attempted
A more obvious example of the differences:
use constant LIST => ('a' .. 'y');
use constant SCALAR => 'z';
for $char (LIST, SCALAR) {
$char = ord $char;
print "$char\n";
}
>But you're right; a foreach loop doesn't notice all lists. This is error
>free, too:
> for (qw/fred barney/) {
> tr/e/Z/;
> }
But shouldn't this be error free? You're iterating of the result of
the qw operator, not its arguments. Its the same as saying:
for(localtime) {
push, @array, $_;
}
And since a constant list is a subroutine returning a list, we get
similar behaviour.
--
Andrew Langmead
------------------------------
Date: Fri, 17 Oct 1997 16:25:42 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: String manipulation in Perl
Message-Id: <EI7Eyv.30u@world.std.com>
Doug Seay <seay@absyss.fr> writes:
>Try read() to grab fixed sized chunks (4k or 16k are often a good
>values, but "best" values are system specific) and use tr///d to delete
>offending characters. Perhaps
You can get the prefered blocksize for a file by the blksize parameter
from stat().
$ perl -e 'print +(stat STDIN)[11],"\n"'
4096
$ perl -e 'print +(stat STDIN)[11],"\n"' </tmp/bitmap.pl
4096
$ perl -e 'print +(stat STDIN)[11],"\n"' <~/goodbad.zip
1024
$
And if you use read() (not sysread()) it will be reading chunks in the
preferred block size anyway.
--
Andrew Langmead
------------------------------
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 1190
**************************************