[7498] in Perl-Users-Digest
Perl-Users Digest, Issue: 1124 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Oct 4 02:17:25 1997
Date: Fri, 3 Oct 97 23:00:36 -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, 3 Oct 1997 Volume: 8 Number: 1124
Today's topics:
Re: $x = $y || $z - dangerous assumption? <rootbeer@teleport.com>
Re: accessing permissions (rwx) <guptas@slip.net>
Re: associative arrays prob (Lutz Albers)
Re: bingint.pl <rootbeer@teleport.com>
Re: commercial packages w/ perl? Tivoli, ClearCase, DD <nyob@mail.com>
confused about -w (Alex Krohn)
Re: DESPERATE for help with string matching <gabor@vinyl.quickweb.com>
Displaying <cstewart@flash.net>
Re: Displaying <jgostin@shell2.ba.best.com>
Re: Displaying <phousto@cse.dnd.ca>
Re: Displaying <bholzman@mail.earthlink.net>
Re: E-card script error (Abigail)
Re: E-card script error <rootbeer@teleport.com>
Re: foreach my $elem (@elements) - doesn't work! (Tad McClellan)
Help -- Perl5 with IIS on NT4 <dlam@kdn0.attnet.or.jp>
Help... <wilson@cyberdesic.com>
Include gif without <image src= <sawyer@ibm.net>
Re: Installing CGI.pm question <rootbeer@teleport.com>
Re: Multiple Simultaneous prints??? (Lutz Albers)
Re: New To Perl <rootbeer@teleport.com>
Re: Newbie ques: How to concatenate two strings? (Tad McClellan)
Re: pattern matching question <bholzman@mail.earthlink.net>
Re: Perl on NT4 and Mac files on NTFS disk. <rothd@roth.netX>
Re: Problems with CGI::* Module example <rootbeer@teleport.com>
Re: PROOF: VB FASTER THAN PERL, C, C++ (Tad McClellan)
Question: process control in perl <justin.lee@sandiegoca.ncr.com>
Re: Question: process control in perl <bholzman@mail.earthlink.net>
Re: Read/Write access to a file (Tad McClellan)
Re: splitting problems (Alex Krohn)
Re: splitting problems <rootbeer@teleport.com>
Re: System calls (Tad McClellan)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 3 Oct 1997 21:33:44 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Peter.J.Scott@jpl.nasa.gov
Subject: Re: $x = $y || $z - dangerous assumption?
Message-Id: <Pine.GSO.3.96.971003212658.13343G-100000@usertest.teleport.com>
On 3 Oct 1997, Peter Scott wrote:
> Hi. A common idiom I see used in programs and books everywhere is
>
> my $x = shift || $default;
> The thing that bothers me about this - and maybe I'm overreacting - is
> that if there *was* an argument, but it was 0, $x will still get $default.
You're not overreacting. That idiom should be used only when the argument
must be (in the Perl sense) true, if significant.
The Perl development team is working on a way that you could write
something like that which would assign the first defined item (rather than
the first true one) among its operands. With any luck, it'll be in a
future version of Perl.
> (Sorry to force respondents who choose to reply by email to edit
> the To: header, but the spam is just too bad otherwise.)
(Sorry to have edited the To: header so that I could reply by email and by
Usenet at the same time, because any spammers who see this message now
have your address. :-)
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Fri, 03 Oct 1997 20:10:07 -0700
From: Sanjeev & Alka <guptas@slip.net>
Subject: Re: accessing permissions (rwx)
Message-Id: <3435B38F.4BC8@slip.net>
Hi Dhiraj,
I guess what u want is the following code:
I'm assuming an UNIX host.
1. Put this code in a file say rwx.pl.
2. Change the mode
chmod 755 rwx.pl
3. Test the script on any file by using
rwx.pl <any file>
#!/usr/local/bin/perl
$mode = (stat($ARGV[0]))[2];
$urwx = $mode & 0700;
$grwx = $mode & 0070;
$wrwx = $mode & 0007;
printf("File Mode: %o\n", $mode);
printf("urwx Mode: %4o\n", $urwx);
printf("grwx Mode: %4o\n", $grwx);
printf("wrwx Mode: %4o\n", $wrwx);
Sanjeev
------------------------------
Date: Fri, 03 Oct 1997 13:00:41 +0200
From: lutz@muc.de (Lutz Albers)
Subject: Re: associative arrays prob
Message-Id: <lutz-ya023480000310971300410001@news>
In article
<Pine.GSO.3.96.971002072824.24335I-100000@usertest.teleport.com>, Tom
Phoenix <rootbeer@teleport.com> wrote:
>> for ($x=1; $x<=6; $x++)
>
>The more perlish way is like this.
>
> for $x (1..6) { ... }
>
>Or even this.
>
> for (1..6) { ... }
I'm not sure, if this is a good advice :-) If your right boundary is large,
then you'll have a (not so :-) small problem.
Quoting from perlop:
Binary ".." is the range operator, which is really two
different operators depending on the context. In a list
context, it returns an array of values counting (by ones)
from the left value to the right value. This is useful
for writing for (1..10) loops and for doing slice
operations on arrays. Be aware that under the current
implementation, a temporary array is created, so you'll
burn a lot of memory if you write something like this:
for (1 .. 1_000_000) {
# code
}
ciao
lutz
--
Lutz Albers, lutz@muc.de, pgp key available from <http://www.pgp.net>
Do not take life too seriously, you will never get out of it alive.
------------------------------
Date: Fri, 3 Oct 1997 21:43:00 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: David Turley <dturley@rocketmail.com>
Subject: Re: bingint.pl
Message-Id: <Pine.GSO.3.96.971003213555.13343H-100000@usertest.teleport.com>
On Fri, 3 Oct 1997, David Turley wrote:
> I have a script that uses bigint.pl, (as in require bingint.pl;).
You should probably set it up to use Math::BigInt.pm instead, but that's
another subject for another day. :-)
> I have run this without fail on an Apache server, a mac server, and
> under the Win95 port of perl. I have someone trying to install the
> script on their server and is being told by their ISP that they don't
> have bigint.pl. The ISP is telling them to search yahoo, etc to find
> that program!
>
> Who's the bigger idiot? Me or the ISP. Am I wrong in my belief that
> bigint.pl is part of the perl distribution?
It's part of the standard distribution, but it may be that the ISP doesn't
have any of the .pl files installed (for whatever reason). It seems to me
more likely that the ISP simply doesn't have @INC set up to point to the
right place. :-)
Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Fri, 3 Oct 1997 22:23:34 -0500
From: "Paul" <nyob@mail.com>
Subject: Re: commercial packages w/ perl? Tivoli, ClearCase, DDTS, ... :-)
Message-Id: <614cn5$fme$1@farragut.srv.paranet.com>
MKS Tool kit by Mortice and Kern www.mks.com Comes with Win32 Perl and it is
installed as part of the setup. The program creates a UNIX Korn Shell for
NT/95 Complete with AWK, SED, VI, Diff and so on. Great tool (Pricey).
Paul Coogan
coogan@webtop.com
Richard A. Stewart wrote in message <60ls5f$h4k@nntpb.cb.lucent.com>...
>Are there any lists of commercial packages that formally
>include and/or utilize perl? Could folks please post
>such lists (URL's) or the names of other packages like
>Tivoli, ClearCase & DDTS that now include & use perl.
>
------------------------------
Date: Fri, 03 Oct 1997 23:57:13 GMT
From: alex@gossamer-threads.com (Alex Krohn)
Subject: confused about -w
Message-Id: <343584f8.197023858@news.supernews.com>
Hi, I'm a little confused about the warnings I get with the -w flag. I
see a whole bunch of:
Use of uninitialized value at /webshare/root/links/admin/db.pl line
711.
and
Name "main::auth_no_authentication" used only once: possible typo at
C:\WEBSHARE\ROOT\LINKS\ADMIN\ADMIN.CGI line 45.
warnings.
For the first warning, line 711 is:
my ($day2, $mon2, $year2) = split(/-/, $_[1]);
so I'm assuming it is warning about using $_[1], as the others are
getting assigned values (not being used). I also get similar warnings
when I use %ENV vars. Aren't these variables initilized by Perl?
As for the second warning, the line in question is:
&auth_cleanup unless ($auth_no_authentication);
I've declared $auth_no_authentication in a sepearte file that I've
brought in using require. Do I have to declare it as a constant
somehow?
Thanks for your help,
Alex
------------------------------
Date: 4 Oct 1997 02:04:21 GMT
From: Gabor Egressy <gabor@vinyl.quickweb.com>
Subject: Re: DESPERATE for help with string matching
Message-Id: <614875$ala$1@flint.sentex.net>
Carol Lynn Smith <carols@sabre.com> wrote:
: Kinda new at Perl, so forgive me if I ask a simple question:
: I have an HTML file with several <table> tags throughout. I need to
: match the first occurence of "<table> the stuff in between which can
: be just about anything </table>" (this represents the header) ...and
: then I need to match the last occurrence of "<table> the stuff in
: between which can be just about anything </table>" (this would be the
: footer).
undef $/;
$html=<STDIN>;
@head_foot = $html =~ /<table.*?>(.*?)<\/table>.*<table.*?>(.*?)<\/table>/is;
That should do it, I think.
gabor.
--
(It's sorta like sed, but not. It's sorta like awk, but not. etc.)
Guilty as charged. Perl is happily ugly, and happily derivative.
-- Larry Wall in <1992Aug26.184221.29627@netlabs.com>
------------------------------
Date: Fri, 3 Oct 1997 20:42:39 -0500
From: "Chuck" <cstewart@flash.net>
Subject: Displaying
Message-Id: <6146aj$q72$1@excalibur.flash.net>
I need to display the first twenty lines of a text file (lines 1 thru 20).
Thanks.... (again)
------------------------------
Date: 4 Oct 1997 02:05:22 GMT
From: Jeff Gostin <jgostin@shell2.ba.best.com>
Subject: Re: Displaying
Message-Id: <614892$loa$1@nntp1.ba.best.com>
Chuck <cstewart@flash.net> wrote:
: I need to display the first twenty lines of a text file (lines 1 thru 20).
So write a script that does it ? :) It's easy... an 'open' statement, a
'while' statement, a print statement in the 'while', and a 'close' statement
afterwards... Or use 'tail' in combination with 'more' at your prompt... or a
'for' statement in place of the 'while'. This assumes you're not going to
error-check the reads, but if you are, it's another line or so inside the
loop.
"Learning Perl" -- it is your friend. It's not much money. Your
bookstore will probably have it, and you should have it. RTFM is your
friend. :)
--Jeff
------------------------------
Date: Fri, 03 Oct 1997 23:42:13 -0400
From: Phil Houstoun <phousto@cse.dnd.ca>
Subject: Re: Displaying
Message-Id: <3435BB15.34380302@cse.dnd.ca>
Chuck wrote:
>
> I need to display the first twenty lines of a text file (lines 1 thru 20).
> Thanks.... (again)
while(<STDIN>) {
(1 .. 20) && print;
}
------------------------------
Date: Fri, 03 Oct 1997 23:59:36 -0400
From: Benjamin Holzman <bholzman@mail.earthlink.net>
Subject: Re: Displaying
Message-Id: <3435BF28.9E6B2387@mail.earthlink.net>
Jeff Gostin wrote:
>
> Chuck <cstewart@flash.net> wrote:
> : I need to display the first twenty lines of a text file (lines 1 thru 20).
>
> So write a script that does it ? :) It's easy... an 'open' statement, a
> 'while' statement, a print statement in the 'while', and a 'close' statement
> afterwards... Or use 'tail' in combination with 'more' at your prompt... or a
> 'for' statement in place of the 'while'. This assumes you're not going to
> error-check the reads, but if you are, it's another line or so inside the
> loop.
>
> "Learning Perl" -- it is your friend. It's not much money. Your
> bookstore will probably have it, and you should have it. RTFM is your
> friend. :)
>
> --Jeff
Or, if you're an a UNIX box, you could use the command:
'head -20 <filename>'
------------------------------
Date: 4 Oct 1997 00:16:09 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: E-card script error
Message-Id: <slrn63b2qd.sgg.abigail@betelgeuse.rel.fnx.com>
Mikael Granath (mgranath@algonet.se) wrote on 1494 September 1993 in
<URL: news:01bcd04f$1d453580$799364c3@komjotr>:
++ I have a problem....
++ I'm trying to run a e-card script but when I'm pressing the submit-button
++ (Skicka kortet) I'm having "Server error". Can anyone tell me why??? The
++ page is http://www.algonet.se/~mgranath/postcard.html I'm also attach the
++ pl file
++ *************************************
++ Titta in i bageriet och baka en kaka!
++ http://www.algonet.se/~mgranath
++ *************************************
++ begin 600 postcard.pl
++ M(R$O=7-R+VQO8V%L+V)I;B]P97)L(" -"B,C(R,C(R,C(R,C(R,C(R,C(R,C
++ M(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C
++ M(R,C(R,C(R,C(R,C(PT*(R!0;W-T8V%R9"YC9VD@1G)E92!V97)S:6]N(2!"
++ M97=L97D@26YT97)N970@4V]L=71I;VYS(#QD86QE0&)E=VQE>2YN970^#0IM
++ M>2 D5D524TE/3CTG4&]S=&-A<F0N8V=I('8Q+C!B-B<[(",P,RTQ,2TY-R @
Ah, yes. It's something said Perl just looks like line noise, but it's a
bit better than that. What you have above is a typical sendmail file. Try
using your program as a sendmail configuration file, it should go much
better then.
HTH. HAND.
Abigail
------------------------------
Date: Fri, 3 Oct 1997 22:09:33 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Mikael Granath <mgranath@algonet.se>
Subject: Re: E-card script error
Message-Id: <Pine.GSO.3.96.971003220810.13343N-100000@usertest.teleport.com>
On 3 Oct 1997, Mikael Granath wrote:
> I'm trying to run a e-card script but when I'm pressing the submit-button
> (Skicka kortet) I'm having "Server error". Can anyone tell me why???
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.
http://www.perl.com/perl/
http://www.perl.com/perl/faq/
http://www.perl.com/perl/faq/idiots-guide.html
> I'm also attach the pl file
> begin 600 postcard.pl
> M(R$O=7-R+VQO8V%L+V)I;B]P97)L(" -"B,C(R,C(R,C(R,C(R,C(R,C(R,C
> M(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C
Don't do that. :-) Thanks!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Sat, 4 Oct 1997 00:30:36 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: foreach my $elem (@elements) - doesn't work!
Message-Id: <s9k416.t21.ln@localhost>
Jerry Williams (jwillia@medicode.com) wrote:
: foreach my $elem (@elements) {
: Missing $ on loop variable at ./tp line 7.
: This is right out of the perlsyn manual page. It would appear that you
: can't use my
: to declare the variable in the foreach loop. Is this a bug? Or are the
: docs wrong?
: Or is this a version thing. I am running perl5.003. Or is there
: something that I am missing? Thanks for any help!
You are missing 5.004 (it is a version thing)
--
Tad McClellan SGML Consulting
tadmc@flash.net Perl programming
Fort Worth, Texas
------------------------------
Date: Sat, 4 Oct 1997 13:46:11 +0900
From: "David Lam" <dlam@kdn0.attnet.or.jp>
Subject: Help -- Perl5 with IIS on NT4
Message-Id: <614hr9$89a$1@news.kadena.attnet.or.jp>
Perl5 with IIS 2.0 on NT4 cannot retrieve filenames in a directory
(functions as glob, opendir, readdir, while <*.*> {} all do not work). Can
anybody give me an idea of fixing this problem?
------------------------------
Date: Fri, 3 Oct 1997 17:23:23 -0700
From: "Mary Wilson" <wilson@cyberdesic.com>
Subject: Help...
Message-Id: <6143a3$2et$1@news.northwest.com>
I have a statement in my paths.cgi
that states
$recipient= ( and here you put the e-mail of the recipient)
but I want the recipient to change depending on were the director
is that the person is using to execute the program...
this is an idea I have .....
any help would be great for I am new at this....
$recipient = 'shop@works.com';
if ( $ENV{'HTTP_REFERER'}) eq= "http://www.works.com/cgi-bin/add2.cgi;
elsif ( $ENV{'HTTP_REFERER'})
eq="http://www.works.com/fmz/cgi-bin/add2.cgi;
$recipient = 'shop@fmz.com';
elsif ( $ENV{'HTTP_REFERER'})
eq="http://www.works.com/inter/cgi-bin/add2.cgi;
$recipient = 'shop@inter.com';
my email... hountz@diningtable.com
------------------------------
Date: Fri, 03 Oct 1997 20:46:33 -0700
From: Tim Sawyer <sawyer@ibm.net>
Subject: Include gif without <image src=
Message-Id: <3435BC19.73BAFFD1@ibm.net>
I'm calling a c program from perl cgi that returns gif data. I could
just redirect the data to a gif file and display it with an <image
src=...> tag but I rather not deal with temp file maitenance and
multiuser problems. Isn't there a way, with mime types or something, to
'imbed' the gif data in html without using the <image> tag? Or can the
<image> tag be faked into accepting gif data from STDIN?
--
- Tim -
------------------------------
Date: Fri, 3 Oct 1997 21:55:51 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Barry Kaplan <barry@megaspace.com>
Subject: Re: Installing CGI.pm question
Message-Id: <Pine.GSO.3.96.971003215038.13343J-100000@usertest.teleport.com>
On Thu, 2 Oct 1997, Barry Kaplan wrote:
> I'm trying to install the latest CGI.pm-2.37b5 on my ISP's unix box.
> When I run "perl Makefile.PL", I get the following error message:
>
> web: {5} % perl5 Makefile.PL
> Can't locate Carp.pm in @INC at ExtUtils/MakeMaker.pm line 13.
> BEGIN failed--compilation aborted at ExtUtils/MakeMaker.pm line 13.
> BEGIN failed--compilation aborted at Makefile.PL line 1.
>
> I've tried placing Carp.pm in an ExtUtils subdirectory and but it still
> yeilds the same results.
Perl's probably not looking for it in an ExtUtils subdirectory. But if
Makefile.PL can't find Carp.pm, your Perl is probably mis-installed. (In
particular, your value for @INC doesn't include the directory where vital
modules like Carp are kept. Or, there's no such directory, because the
vital modules weren't even installed!)
The easiest thing is probably to have your sysadmin re-install Perl,
including its libraries. As a nifty bonus, if the sysadmin installs the
latest Perl, version 5.004, you'll get a version of CGI.pm installed at no
extra charge! (But if you want the latest, possibly buggy, beta version of
CGI.pm, you'll still need to install that yourself. :-)
Good luck!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Fri, 03 Oct 1997 13:08:54 +0200
From: lutz@muc.de (Lutz Albers)
Subject: Re: Multiple Simultaneous prints???
Message-Id: <lutz-ya023480000310971308540001@news>
In article <3433562b.17976966@news.ilstu.edu>, wviecht@rs6000.cmp.ilstu.edu
(Wolfgang Viechtbauer) wrote:
>So I should use the flock() command. Okay, okay. But what if you are
>not running your scripts on a UNIX system??? Won't that crash your
>system?
>
>So what about:
>
>sysopen(FH, "file.lock", O_WRONLY|O_EXCL|O_CREAT, 0644)
> or die "can't open file.lock: $!":
>
>What the heck is going on in here?
This will work on Unix systems, but only if the filesystem you're writting
the lock onto is NOT NFS mounted. On a local fs this operation is handled
atomic inside the kernel (and succeds only if the lock doen't exists).
>In general then: What should you do if you cannot use the flock()
>command, because you are running your scripts on Windows NT or Windows
>95?
Complain to MS about the non-existant lock code ? Write a lock yourself ?
Check CPAN for some IPC modules that work under Win and write some sync
code ? Write a own IPC module ?
To quote a friend "It Can Be Done !"
ciao
lutz
--
Lutz Albers, lutz@muc.de, pgp key available from <http://www.pgp.net>
Do not take life too seriously, you will never get out of it alive.
------------------------------
Date: Fri, 3 Oct 1997 22:02:10 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Benjamin Sisco <navigato@grove.ufl.edu>
Subject: Re: New To Perl
Message-Id: <Pine.GSO.3.96.971003215948.13343L-100000@usertest.teleport.com>
On Fri, 3 Oct 1997, Benjamin Sisco wrote:
> Subject: New To Perl
Please check out this helpful information on choosing good subject
lines. It will be a big help to you in making it more likely that your
requests will be answered.
http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post
> Most of the interpreters seem to be unix based.
What interpreters? Do you mean the Perl interpreter? (It's really a
compiler, internally, but that's okay. :-)
> I have a win/dos based system
> Are there any suggestions on software that will run in this environment?
Perl will run in that environment. :-)
(If you're asking something else, I can't tell what it is. If you're
looking for general software for win/dos systems, you might try asking in
a win/dos newsgroup, of course.)
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Fri, 3 Oct 1997 23:59:31 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Newbie ques: How to concatenate two strings?
Message-Id: <jfi416.821.ln@localhost>
Koll Simonds (ksimonds@graphicaldynamics.com) wrote:
: > >Perhaps you shouldn't modify a program in any language if you
: > >don't know the language.
: >
: > That wasn't the advice I asked, Abigail, but thanks anyway.
: >
: > >"Hey Doc, this has GOT to be the ultimate newbie question, but I don't
: > > know medication, and I need to fix the lung I'm dealing with while
: > > operating on my kid."
: >
: > I'm sorry, Abs, I didn't know you owned this newsgroup.
: Ah, you grovel and genuflect to those who know more (the perl way) and you
: still get your chops busted for asking a newbie question. Perhaps those of
^^^^^^^^^^^^^^^
You seem to not have gotten the point.
It is *not* about asking a newbie question.
It is about asking a question that is clearly answered in the docs.
It is *not* about asking a newbie question.
I have seen Abigail answer many newbie questions here before.
It is *not* about asking a newbie question.
I see newbie questions answered here every day.
It is *not* about asking a newbie question.
It is about checking the docs for the answer before posting.
It is expected in nearly all Usenet newsgroups, not just c.l.p.m,
that you check the FAQ for a newsgroup before posting to that newsgroup.
This is just the way it is on Usenet.
: us who don't live the language should search for a newsgroup such as:
: comp.lang.perl.unwashed
: comp.lang.perl.not-elite
: comp.lang.perl.pagans
: Makes Microsoft seem downright warm & fuzzy.
Take a moment and calculate how old you were in 1979...
...
...
...
Got it?
Have you changed your socialization at all in that time period?
Most people have.
Usenet was started in 1979. It has evolved its own set of rules
for a 'polite' society.
It evolved the 'please check the FAQ first' rule because it increased
its chances of survival.
After seeing the same question a few dozen times, people that answer
questions stop reading the newsgroup.
Then all that is left in the newsgroup are people *asking* questions...
It is *not* about asking a newbie question.
--
Tad McClellan SGML Consulting
tadmc@flash.net Perl programming
Fort Worth, Texas
------------------------------
Date: Sat, 04 Oct 1997 00:26:14 -0400
From: Benjamin Holzman <bholzman@mail.earthlink.net>
To: ajohnson@gpu.srv.ualberta.ca
Subject: Re: pattern matching question
Message-Id: <3435C566.D319AFB9@mail.earthlink.net>
[posted & mailed]
> $string = 'a frick aa b aaa banana aaaa fripp';
> $count=()=$string=~/(?=aa)/g;
> print $count;
>
> I only tried it because someone recently posted this:
> ()=(1,2);
> as parsing but doing nothing --- but it does indeed seem to do
> something --- I haven't checked the recent docs to see if this
> 'context switch' is a documented/intended feature or not, but it
> doesn't compile in 5.003 or 5.001.
>
> regards
> andrew
There is a documented way to force a list context on just about anything
you want: @{[expression]}
So, for example,
$count = @{[$string =~ /(?=aa)/g]};
forces the list context on the matching operator, creates a reference to
the array of 'aa's that it returns, dereferences that array, and
evaluates it in a scalar context. Whew!
I find that idiom quite useful, and, IMHO, easier on the eye than that
=()= thingy. Plus, you can embed @{[...]} in double-quoted strings!
Benjamin Holzman
------------------------------
Date: 4 Oct 1997 04:15:11 GMT
From: "Dave Roth" <rothd@roth.netX>
Subject: Re: Perl on NT4 and Mac files on NTFS disk.
Message-Id: <01bcd07c$2c2510c0$a6906ec6@main2>
My $.02 is that NTFS is very different from FAT. If a Mac file has a split
fork such as both the resource and data forks, FAT can only deal with a
flat file so either one fork is lost, both forks are combined or two
seperate files are created.
However, NTFS allows a file to have multiple "streams" so a single file can
have (what a Mac use would call) a resource fork and a data fork as one
descrete file. If you copy a Mac file to NTFS it is possible that the some
of the data, has been placed in a stream (or fork) that perl.exe is unaware
of.
Just my thoughts.
--
================================================================
Dave Roth ...glittering prizes and
Roth Consulting endless compromises, shatter
rothd@roth.netX the illusion of integrity
My email address is disguised to fool automailers. Remove the
trailing 'X' to send me email.
****************************************************************
Use of this message or email address for commercial purposes
(including "junk" mailings) is strictly prohibited and protected
under current international copyright laws and United States
Code, Title 47, Chapter 5, Subchapter II.
Jeremy D. Zawodny <zawodny@hou.moc.com> wrote in article
<3439924e.60506854@igate.hst.moc.com>...
> [cc'd automagically to original author]
>
> On 2 Oct 1997 10:19:32 GMT, patrick769@aol.com (Patrick769) wrote:
>
> >I am working on a perl script using the stat function to get file info.
When
> > run with a mac file on ntfs it returns nothing. When the same file is
moved to
> > a fat disk it returns all file info. Anyone run into this one and how
can it
> > be corrected.
>
> It returns *nothing*?
>
> Could you post some sample code, maybe?
>
> I'd assume you're doing something like:
>
> @stats = stat($file);
>
> and you're saying that @stats is empty?
>
> Which Perl distribution are you using?
>
> 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: Fri, 3 Oct 1997 22:13:19 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: ian c rogers <irogers@biggun.com>
Subject: Re: Problems with CGI::* Module example
Message-Id: <Pine.GSO.3.96.971003221204.13343O-100000@usertest.teleport.com>
On Fri, 3 Oct 1997, ian c rogers wrote:
> Newsgroups: comp.lang.perl, comp.lang.perl.misc
If your news administrator still carries comp.lang.perl, please let him
or her know that that newsgroup has not existed since 1995. If you
have such an outdated newsgroup listing, you are probably missing out
on many other valid newsgroups as well. You'll be doing yourself and
many others a favor to use only comp.lang.perl.misc (and other valid
Perl newsgroups) instead.
> The CGI::Base::html_escape(@R::KEYWORDS) returns absolutely nothing for
> me. Any idea why this might be?
I'd guess that @R::KEYWORDS is empty or undefined. Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Sat, 4 Oct 1997 00:27:46 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: PROOF: VB FASTER THAN PERL, C, C++
Message-Id: <i4k416.t21.ln@localhost>
SpamProofSeal@none.com (SpamProofSeal@none.com) wrote:
Posting anonymously does significant harm to your credibility...
--
Tad McClellan SGML Consulting
tadmc@flash.net Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 03 Oct 1997 17:23:31 -0700
From: Justin Lee <justin.lee@sandiegoca.ncr.com>
Subject: Question: process control in perl
Message-Id: <34358C83.4872@sandiegoca.ncr.com>
I am writing a script in Perl in which I start a
background process with the 'system' function and
then go on to other tasks. Further down into the
script, however, I need to have the program hang and
wait for the background process to complete. What is
the best way to do this? I tried using the 'wait' function,
but this seems to only work with processes created by 'fork',
and not processes created indirectly through 'system'.
Any help or suggestions would be much appreciated.
- Justin
------------------------------
Date: Sat, 04 Oct 1997 00:03:37 -0400
From: Benjamin Holzman <bholzman@mail.earthlink.net>
To: Justin Lee <justin.lee@sandiegoca.ncr.com>
Subject: Re: Question: process control in perl
Message-Id: <3435C019.A66E28DD@mail.earthlink.net>
[posted & mailed]
Justin Lee wrote:
>
> I am writing a script in Perl in which I start a
> background process with the 'system' function and
> then go on to other tasks. Further down into the
> script, however, I need to have the program hang and
> wait for the background process to complete. What is
> the best way to do this? I tried using the 'wait' function,
> but this seems to only work with processes created by 'fork',
> and not processes created indirectly through 'system'.
So create the process directly, using a combination of 'fork' and
'exec', which is exactly what 'system' does, anyway (except that I think
the 'system' call does some mucking around with signal handlers; not
sure, though...)
> Any help or suggestions would be much appreciated.
>
> - Justin
Hope this helps.
Benjamin Holzman
------------------------------
Date: Fri, 3 Oct 1997 23:44:11 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Read/Write access to a file
Message-Id: <rih416.ov.ln@localhost>
Bosch Patrick (bosch@goweb.lu) wrote:
: Tom Phoenix wrote:
: > That's when you use, for example, @list[$counter] instead of
: > $list[$counter], because they're different things. In this case, you
: > wanted the latter.
: I've done it. Indeed I have made a mistake in my scripts. But ... it didn't
: changed anything.
: > If you're still having troubles with this, can you cut this down to a
: > small script which still shows the problem? If you can make it less than
: > about 20 lines, either send it to me or post it to the newsgroup. Good
: > luck!
: So here it is - and even much smaller than 20 lines:
: #!/usr/bin/perl
: @list = ("file1.txt", "file2.txt", "file3.txt", "file4.txt");
: for ($counter=0; $counter < @list; $counter++) {
: open(FILE, "+<". $file[$counter]) || die "Cant open $file[$counter] ";
: chop(@file = <FILE>);
: for($counter_2=0; $counter_2 < @file; $counter_2++) {
: $file[$counter_2] =~ s/1_// } # Changes 1_ to nothing
^^^^^^^^^^^^^^^^^^^^^
So that will make the replacement file shorter than the original file.
: seek(FILE,0,0);
If the seek() fails, you may not know it.
It would be better to know it ;-)
seek(FILE,0,0) || die "seek() failed";
truncate(FILE, 0) || die "truncate() failed"; # set the file to zero length
: for($counter_2=0;$counter_2 < @file; $counter_2++) {
: print FILE $file[$counter_2], "\n" }
: cloes(FILE) }
: So what I did: I have created files with different lines (about 10 for each
: file) and some of them had a "1_" in there lines. The changes have been made
: properly in each of these four files. The files where there was no "1_" patteren
: where restored correctly. But the files with "1_" tags had curious lines added
: below. I guess that there is a connection with the substitution operator, but I
: don't no what kind of connection.
--
Tad McClellan SGML Consulting
tadmc@flash.net Perl programming
Fort Worth, Texas
------------------------------
Date: Sat, 04 Oct 1997 00:34:32 GMT
From: alex@gossamer-threads.com (Alex Krohn)
Subject: Re: splitting problems
Message-Id: <34358ebe.199525825@news.supernews.com>
>$ipaddr = "$ENV{'REMOTE_ADDR'}";
>@fields = split(/./,$ipaddr);
> $ip1 = $fields[0];
> $ip2 = $fields[1];
> $ip3 = $fields[2];
> $ip4 = $fields[3];
You need to backslash that ".".
Try:
($ip1, $ip2, $ip3, $ip4) = split (/\./, $ENV{'REMOTE_ADDR'});
to condense things a bit..
Hope that helps,
Alex
------------------------------
Date: Fri, 3 Oct 1997 22:06:15 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Brent Brookler <brent@tzn.com>
Subject: Re: splitting problems
Message-Id: <Pine.GSO.3.96.971003220252.13343M-100000@usertest.teleport.com>
On Fri, 3 Oct 1997, Brent Brookler wrote:
> $ipaddr = "$ENV{'REMOTE_ADDR'}";
> @fields = split(/./,$ipaddr);
Dot is a special character in regular expressions. If you want to match a
literal dot, backwhack it.
Having said that, does the inet_aton function (or maybe some of the
others) in Socket.pm do something you're wanting to do? That might be the
easier way to accomplish some things. Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Sat, 4 Oct 1997 00:16:36 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: System calls
Message-Id: <kfj416.t21.ln@localhost>
Bosch Patrick (bosch@goweb.lu) wrote:
: Hello!
: I just wanted to know wich is the excact way to execute system commands within
^^^^^^
^^^^^^
: Perl. I have tried
I think if you look up the system function in the perlfunc man page
that is included with the distribution of perl, you would have your answer.
: print '/usr/bin/tar -cvf $file $directory';
: But all he did was printing to standard output.
That is because all you asked it to do was to print it to standard output.
--
Tad McClellan SGML Consulting
tadmc@flash.net Perl programming
Fort Worth, Texas
------------------------------
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 1124
**************************************